From 87131f399eda8e8e35adfce16ce3e34b988a523e Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Thu, 8 Oct 2015 10:02:58 -0400 Subject: [PATCH] Deprecate A_ldiv_B!(SparseMatrixCSC, StrideVecOrMat) thereby fixing #10787 --- NEWS.md | 3 +++ base/deprecated.jl | 4 ++++ base/sparse/linalg.jl | 14 -------------- test/sparsedir/sparse.jl | 3 --- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/NEWS.md b/NEWS.md index 75a5cc9246855..8adc4a08e24ae 100644 --- a/NEWS.md +++ b/NEWS.md @@ -45,6 +45,9 @@ Library improvements Deprecated or removed --------------------- + * The method `A_ldiv_B!(SparseMatrixCSC, StrideVecOrMat)` has been deprecated in favor + of versions that require the matrix to in factored form ([#13496]). + Julia v0.4.0 Release Notes ========================== diff --git a/base/deprecated.jl b/base/deprecated.jl index 687ff736c9316..555bcc2197013 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -843,6 +843,7 @@ for f in (:remotecall, :remotecall_fetch, :remotecall_wait) end end +#13465 @deprecate cov(x::AbstractVector; corrected=true, mean=Base.mean(x)) covm(x, mean, corrected) @deprecate cov(X::AbstractMatrix; vardim=1, corrected=true, mean=Base.mean(X, vardim)) covm(X, mean, vardim, corrected) @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 @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) @deprecate_binding SparseMatrix SparseArrays + +#13496 +@deprecate A_ldiv_B!(A::SparseMatrixCSC, B::StridedVecOrMat) A_ldiv_B!(factorize(A), B) diff --git a/base/sparse/linalg.jl b/base/sparse/linalg.jl index 9475575073df7..526365ab55b0f 100644 --- a/base/sparse/linalg.jl +++ b/base/sparse/linalg.jl @@ -165,20 +165,6 @@ function spmatmul{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti}; end ## solvers -function A_ldiv_B!(A::SparseMatrixCSC, b::AbstractVecOrMat) - if eltype(b)<:Complex; A = complex(A); end - - if istril(A) - # TODO: Fix diagonal case. Diagonal(A.nzval) needs to handle - # the case where there are zeros on the diagonal and error out. - # It also does not work in the complex case. VBS. - #if istriu(A); return A_ldiv_B!(Diagonal(A.nzval), b); end - return fwdTriSolve!(A, b) - end - if istriu(A); return bwdTriSolve!(A, b); end - return A_ldiv_B!(lufact(A),b) -end - function fwdTriSolve!(A::SparseMatrixCSC, B::AbstractVecOrMat) # forward substitution for CSC matrices n = length(B) diff --git a/test/sparsedir/sparse.jl b/test/sparsedir/sparse.jl index 27e363354888b..1fa66634cec7a 100644 --- a/test/sparsedir/sparse.jl +++ b/test/sparsedir/sparse.jl @@ -126,7 +126,6 @@ for i = 1:5 @test (maximum(abs(a\b - full(a)\b)) < 1000*eps()) @test (maximum(abs(a'\b - full(a')\b)) < 1000*eps()) @test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps()) - @test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps()) a = speye(5) + tril(0.1*sprandn(5, 5, 0.2) + 0.1*im*sprandn(5, 5, 0.2)) b = randn(5,3) @@ -145,7 +144,6 @@ for i = 1:5 @test (maximum(abs(a\b - full(a)\b)) < 1000*eps()) @test (maximum(abs(a'\b - full(a')\b)) < 1000*eps()) @test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps()) - @test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps()) a = speye(5) + triu(0.1*sprandn(5, 5, 0.2) + 0.1*im*sprandn(5, 5, 0.2)) b = randn(5,3) @@ -164,7 +162,6 @@ for i = 1:5 @test (maximum(abs(a\b - full(a)\b)) < 1000*eps()) @test (maximum(abs(a'\b - full(a')\b)) < 1000*eps()) @test (maximum(abs(a.'\b - full(a.')\b)) < 1000*eps()) - @test (maximum(abs(A_ldiv_B!(a,copy(b)) - full(a)\b)) < 1000*eps()) a = spdiagm(randn(5)) + im*spdiagm(randn(5)) b = randn(5,3)