Skip to content

Commit b0694a2

Browse files
committed
Deprecate A_ldiv_B!(SparseMatrixCSC, StrideVecOrMat) thereby fixing #10787
1 parent d3af973 commit b0694a2

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

base/deprecated.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -841,4 +841,6 @@ for f in (:remotecall, :remotecall_fetch, :remotecall_wait)
841841
@deprecate ($f)(w::Worker, f::Function, args...) ($f)(f, w::Worker, args...)
842842
@deprecate ($f)(id::Integer, f::Function, args...) ($f)(f, id::Integer, args...)
843843
end
844-
end
844+
end
845+
846+
@deprecate A_ldiv_B!(A::SparseMatrixCSC, B::StridedVecOrMat) A_ldiv_B!(factorize(A), B)

base/sparse/linalg.jl

-14
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,6 @@ function spmatmul{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti};
165165
end
166166

167167
## solvers
168-
function A_ldiv_B!(A::SparseMatrixCSC, b::AbstractVecOrMat)
169-
if eltype(b)<:Complex; A = complex(A); end
170-
171-
if istril(A)
172-
# TODO: Fix diagonal case. Diagonal(A.nzval) needs to handle
173-
# the case where there are zeros on the diagonal and error out.
174-
# It also does not work in the complex case. VBS.
175-
#if istriu(A); return A_ldiv_B!(Diagonal(A.nzval), b); end
176-
return fwdTriSolve!(A, b)
177-
end
178-
if istriu(A); return bwdTriSolve!(A, b); end
179-
return A_ldiv_B!(lufact(A),b)
180-
end
181-
182168
function fwdTriSolve!(A::SparseMatrixCSC, B::AbstractVecOrMat)
183169
# forward substitution for CSC matrices
184170
n = length(B)

test/sparsedir/sparse.jl

-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ for i = 1:5
126126
@test (maximum(abs(a\b - full(a)\b)) < 1000*eps())
127127
@test (maximum(abs(a'\b - full(a')\b)) < 1000*eps())
128128
@test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps())
129-
@test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps())
130129

131130
a = speye(5) + tril(0.1*sprandn(5, 5, 0.2) + 0.1*im*sprandn(5, 5, 0.2))
132131
b = randn(5,3)
@@ -145,7 +144,6 @@ for i = 1:5
145144
@test (maximum(abs(a\b - full(a)\b)) < 1000*eps())
146145
@test (maximum(abs(a'\b - full(a')\b)) < 1000*eps())
147146
@test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps())
148-
@test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps())
149147

150148
a = speye(5) + triu(0.1*sprandn(5, 5, 0.2) + 0.1*im*sprandn(5, 5, 0.2))
151149
b = randn(5,3)
@@ -164,7 +162,6 @@ for i = 1:5
164162
@test (maximum(abs(a\b - full(a)\b)) < 1000*eps())
165163
@test (maximum(abs(a'\b - full(a')\b)) < 1000*eps())
166164
@test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps())
167-
@test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps())
168165

169166
a = spdiagm(randn(5)) + im*spdiagm(randn(5))
170167
b = randn(5,3)

0 commit comments

Comments
 (0)