Skip to content

Commit 87131f3

Browse files
committed
Deprecate A_ldiv_B!(SparseMatrixCSC, StrideVecOrMat) thereby fixing #10787
1 parent d711b7d commit 87131f3

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Library improvements
4545
Deprecated or removed
4646
---------------------
4747

48+
* The method `A_ldiv_B!(SparseMatrixCSC, StrideVecOrMat)` has been deprecated in favor
49+
of versions that require the matrix to in factored form ([#13496]).
50+
4851
Julia v0.4.0 Release Notes
4952
==========================
5053

base/deprecated.jl

+4
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ for f in (:remotecall, :remotecall_fetch, :remotecall_wait)
843843
end
844844
end
845845

846+
#13465
846847
@deprecate cov(x::AbstractVector; corrected=true, mean=Base.mean(x)) covm(x, mean, corrected)
847848
@deprecate cov(X::AbstractMatrix; vardim=1, corrected=true, mean=Base.mean(X, vardim)) covm(X, mean, vardim, corrected)
848849
@deprecate cov(x::AbstractVector, y::AbstractVector; corrected=true, mean=(Base.mean(x), Base.mean(y))) covm(x, mean[1], y, mean[2], corrected)
@@ -854,3 +855,6 @@ end
854855
@deprecate cor(X::AbstractVecOrMat, Y::AbstractVecOrMat; vardim=1, mean=(Base.mean(X, vardim), Base.mean(Y, vardim))) corm(X, mean[1], Y, mean[2], vardim)
855856

856857
@deprecate_binding SparseMatrix SparseArrays
858+
859+
#13496
860+
@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)