Skip to content

Commit

Permalink
Deprecate ones(A::AbstractArray[, opts...]) and zeros(A::AbstractArra…
Browse files Browse the repository at this point in the history
…y[, opts...]) methods.
  • Loading branch information
Sacha0 committed Nov 21, 2017
1 parent 2e1ac64 commit ffdfdc9
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 78 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ Deprecated or removed
* `expand(ex)` and `expand(module, ex)` have been deprecated in favor of
`Meta.lower(module, ex)` ([#22064, #24278]).

* `ones(A::AbstractArray[, opts...])` and `zeros(A::AbstractArray[, opts...])` methods
have been deprecated in favor of `fill!(similar(A[, opts...]), {1|0})` (or, absent
`opts...` and where appropriate, alternatively `fill!(copy(A), {1|0})`,
`fill({1|0}, size(A))`, or `{ones|zeros}(size(A))`) ([#24656]).

* The `Operators` module is deprecated. Instead, import required operators explicitly
from `Base`, e.g. `import Base: +, -, *, /` ([#22251]).

Expand Down
5 changes: 0 additions & 5 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ function ones end

for (fname, felt) in ((:zeros, :zero), (:ones, :one))
@eval begin
# allow signature of similar
$fname(a::AbstractArray, ::Type{T}, dims::Tuple) where {T} = fill!(similar(a, T, dims), $felt(T))
$fname(a::AbstractArray, ::Type{T}, dims...) where {T} = fill!(similar(a, T, dims...), $felt(T))
$fname(a::AbstractArray, ::Type{T}=eltype(a)) where {T} = fill!(similar(a, T), $felt(T))

$fname(::Type{T}, dims::NTuple{N, Any}) where {T, N} = fill!(Array{T,N}(Dims(dims)), $felt(T))
$fname(dims::Tuple) = ($fname)(Float64, dims)
$fname(::Type{T}, dims...) where {T} = $fname(T, dims)
Expand Down
10 changes: 10 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,16 @@ end
# `SSHCredentials` and `UserPasswordCredentials` constructors using `prompt_if_incorrect`
# are deprecated in base/libgit2/types.jl.

# deprecate ones/zeros methods accepting an array as first argument
@deprecate ones(a::AbstractArray, ::Type{T}, dims::Tuple) where {T} fill!(similar(a, T, dims), 1)
@deprecate ones(a::AbstractArray, ::Type{T}, dims...) where {T} fill!(similar(a, T, dims...), 1)
@deprecate ones(a::AbstractArray, ::Type{T}) where {T} fill!(similar(a, T), 1)
@deprecate ones(a::AbstractArray) fill!(similar(a), 1)
@deprecate zeros(a::AbstractArray, ::Type{T}, dims::Tuple) where {T} fill!(similar(a, T, dims), 0)
@deprecate zeros(a::AbstractArray, ::Type{T}, dims...) where {T} fill!(similar(a, T, dims...), 0)
@deprecate zeros(a::AbstractArray, ::Type{T}) where {T} fill!(similar(a, T), 0)
@deprecate zeros(a::AbstractArray) fill!(similar(a), 0)

# PR #23711
@eval LibGit2 begin
@deprecate get_creds!(cache::CachedCredentials, credid, default) get!(cache, credid, default)
Expand Down
2 changes: 1 addition & 1 deletion base/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function svd(D::Diagonal{<:Number})
piv = sortperm(S, rev = true)
U = Diagonal(D.diag ./ S)
Up = hcat([U[:,i] for i = 1:length(D.diag)][piv]...)
V = Diagonal(ones(D.diag))
V = Diagonal(fill!(similar(D.diag), 1))
Vp = hcat([V[:,i] for i = 1:length(D.diag)][piv]...)
return (Up, S[piv], Vp)
end
Expand Down
8 changes: 4 additions & 4 deletions base/linalg/tridiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ function tril!(M::SymTridiagonal, k::Integer=0)
return Tridiagonal(M.ev,M.dv,copy(M.ev))
elseif k == -1
fill!(M.dv,0)
return Tridiagonal(M.ev,M.dv,zeros(M.ev))
return Tridiagonal(M.ev,M.dv,fill!(similar(M.ev), 0))
elseif k == 0
return Tridiagonal(M.ev,M.dv,zeros(M.ev))
return Tridiagonal(M.ev,M.dv,fill!(similar(M.ev), 0))
elseif k >= 1
return Tridiagonal(M.ev,M.dv,copy(M.ev))
end
Expand All @@ -303,9 +303,9 @@ function triu!(M::SymTridiagonal, k::Integer=0)
return Tridiagonal(M.ev,M.dv,copy(M.ev))
elseif k == 1
fill!(M.dv,0)
return Tridiagonal(zeros(M.ev),M.dv,M.ev)
return Tridiagonal(fill!(similar(M.ev), 0),M.dv,M.ev)
elseif k == 0
return Tridiagonal(zeros(M.ev),M.dv,M.ev)
return Tridiagonal(fill!(similar(M.ev), 0),M.dv,M.ev)
elseif k <= -1
return Tridiagonal(M.ev,M.dv,copy(M.ev))
end
Expand Down
18 changes: 1 addition & 17 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2173,11 +2173,9 @@ Base.convert(::Type{Float64}, x::F21666) = Float64(x.x)
end

@testset "zeros and ones" begin
@test ones([1,2], Float64, (2,3)) == ones(2,3)
@test ones(2) == ones(Int, 2) == ones([2,3], Float32, 2) == [1,1]
@test ones(2) == ones(Int, 2) == [1,1]
@test isa(ones(2), Vector{Float64})
@test isa(ones(Int, 2), Vector{Int})
@test isa(ones([2,3], Float32, 2), Vector{Float32})

function test_zeros(arr, T, s)
@test all(arr .== 0)
Expand All @@ -2193,22 +2191,8 @@ end
test_zeros(zeros(Int, 2, 3), Matrix{Int}, (2,3))
test_zeros(zeros(Int, (2, 3)), Matrix{Int}, (2,3))

test_zeros(zeros([1 2; 3 4]), Matrix{Int}, (2, 2))
test_zeros(zeros([1 2; 3 4], Float64), Matrix{Float64}, (2, 2))

zs = zeros(SparseMatrixCSC([1 2; 3 4]), Complex{Float64}, (2,3))
test_zeros(zs, SparseMatrixCSC{Complex{Float64}}, (2, 3))

# #19265"
@test_throws ErrorException zeros(Float64, [1.]) # TODO change to MethodError, when v0.6 deprecations are done
x = [1.]
test_zeros(zeros(x, Float64), Vector{Float64}, (1,))
@test x == [1.]

# exotic indexing
oarr = zeros(randn(3), UInt16, 1:3, -1:0)
@test indices(oarr) == (1:3, -1:0)
test_zeros(oarr.parent, Matrix{UInt16}, (3, 2))
end

# issue #11053
Expand Down
23 changes: 13 additions & 10 deletions test/linalg/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,32 @@ srand(1)
end

@testset "triu and tril" begin
zerosdv = zeros(elty, length(dv))
zerosev = zeros(elty, length(ev))
bidiagcopy(dv, ev, uplo) = Bidiagonal(copy(dv), copy(ev), uplo)

@test istril(Bidiagonal(dv,ev,:L))
@test !istril(Bidiagonal(dv,ev,:U))
@test tril!(bidiagcopy(dv,ev,:U),-1) == Bidiagonal(zeros(dv),zeros(ev),:U)
@test tril!(bidiagcopy(dv,ev,:L),-1) == Bidiagonal(zeros(dv),ev,:L)
@test tril!(bidiagcopy(dv,ev,:U),-2) == Bidiagonal(zeros(dv),zeros(ev),:U)
@test tril!(bidiagcopy(dv,ev,:L),-2) == Bidiagonal(zeros(dv),zeros(ev),:L)
@test tril!(bidiagcopy(dv,ev,:U),-1) == Bidiagonal(zerosdv,zerosev,:U)
@test tril!(bidiagcopy(dv,ev,:L),-1) == Bidiagonal(zerosdv,ev,:L)
@test tril!(bidiagcopy(dv,ev,:U),-2) == Bidiagonal(zerosdv,zerosev,:U)
@test tril!(bidiagcopy(dv,ev,:L),-2) == Bidiagonal(zerosdv,zerosev,:L)
@test tril!(bidiagcopy(dv,ev,:U),1) == Bidiagonal(dv,ev,:U)
@test tril!(bidiagcopy(dv,ev,:L),1) == Bidiagonal(dv,ev,:L)
@test tril!(bidiagcopy(dv,ev,:U)) == Bidiagonal(dv,zeros(ev),:U)
@test tril!(bidiagcopy(dv,ev,:U)) == Bidiagonal(dv,zerosev,:U)
@test tril!(bidiagcopy(dv,ev,:L)) == Bidiagonal(dv,ev,:L)
@test_throws ArgumentError tril!(bidiagcopy(dv, ev, :U), -n - 2)
@test_throws ArgumentError tril!(bidiagcopy(dv, ev, :U), n)

@test istriu(Bidiagonal(dv,ev,:U))
@test !istriu(Bidiagonal(dv,ev,:L))
@test triu!(bidiagcopy(dv,ev,:L),1) == Bidiagonal(zeros(dv),zeros(ev),:L)
@test triu!(bidiagcopy(dv,ev,:U),1) == Bidiagonal(zeros(dv),ev,:U)
@test triu!(bidiagcopy(dv,ev,:U),2) == Bidiagonal(zeros(dv),zeros(ev),:U)
@test triu!(bidiagcopy(dv,ev,:L),2) == Bidiagonal(zeros(dv),zeros(ev),:L)
@test triu!(bidiagcopy(dv,ev,:L),1) == Bidiagonal(zerosdv,zerosev,:L)
@test triu!(bidiagcopy(dv,ev,:U),1) == Bidiagonal(zerosdv,ev,:U)
@test triu!(bidiagcopy(dv,ev,:U),2) == Bidiagonal(zerosdv,zerosev,:U)
@test triu!(bidiagcopy(dv,ev,:L),2) == Bidiagonal(zerosdv,zerosev,:L)
@test triu!(bidiagcopy(dv,ev,:U),-1) == Bidiagonal(dv,ev,:U)
@test triu!(bidiagcopy(dv,ev,:L),-1) == Bidiagonal(dv,ev,:L)
@test triu!(bidiagcopy(dv,ev,:L)) == Bidiagonal(dv,zeros(ev),:L)
@test triu!(bidiagcopy(dv,ev,:L)) == Bidiagonal(dv,zerosev,:L)
@test triu!(bidiagcopy(dv,ev,:U)) == Bidiagonal(dv,ev,:U)
@test_throws ArgumentError triu!(bidiagcopy(dv, ev, :U), -n)
@test_throws ArgumentError triu!(bidiagcopy(dv, ev, :U), n + 2)
Expand Down
4 changes: 2 additions & 2 deletions test/linalg/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ end
A = diagm(-2 => dl2, -1 => dl, 0 => d, 1 => du)
@test A\C D
@test_throws DimensionMismatch LAPACK.gbtrs!('N',2,1,6,AB,ipiv,ones(elty,7,6))
@test_throws Base.LinAlg.LAPACKException LAPACK.gbtrf!(2,1,6,zeros(AB))
@test_throws Base.LinAlg.LAPACKException LAPACK.gbtrf!(2,1,6,zeros(elty,6,6))
end
end

Expand Down Expand Up @@ -405,7 +405,7 @@ end
@test_throws DimensionMismatch LAPACK.stev!('U',d,rand(elty,10))
@test_throws DimensionMismatch LAPACK.stebz!('A','B',zero(elty),zero(elty),0,0,-1.,d,rand(elty,10))
@test_throws DimensionMismatch LAPACK.stegr!('N','A',d,rand(elty,10),zero(elty),zero(elty),0,0)
@test_throws DimensionMismatch LAPACK.stein!(d,zeros(elty,10),zeros(d),zeros(BlasInt,10),zeros(BlasInt,10))
@test_throws DimensionMismatch LAPACK.stein!(d,zeros(elty,10),zeros(elty,10),zeros(BlasInt,10),zeros(BlasInt,10))
@test_throws DimensionMismatch LAPACK.stein!(d,e,zeros(elty,11),zeros(BlasInt,10),zeros(BlasInt,10))
end
end
Expand Down
20 changes: 10 additions & 10 deletions test/linalg/triangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa
@test_throws ArgumentError tril!(A1, n)
@test triu(A1,0) == t1(diagm(0 => diag(A1)))
@test triu(A1,-1) == t1(tril(triu(A1.data,-1)))
@test triu(A1,1) == LowerTriangular(zeros(A1.data))
@test triu(A1,1) == zeros(size(A1)) # or just @test iszero(triu(A1,1))?
@test_throws ArgumentError triu!(A1, -n)
@test_throws ArgumentError triu!(A1, n + 2)
else
Expand All @@ -120,7 +120,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa
@test_throws ArgumentError triu!(A1, n + 2)
@test tril(A1,0) == t1(diagm(0 => diag(A1)))
@test tril(A1,1) == t1(triu(tril(A1.data,1)))
@test tril(A1,-1) == UpperTriangular(zeros(A1.data))
@test tril(A1,-1) == zeros(size(A1)) # or just @test iszero(tril(A1,-1))?
@test_throws ArgumentError tril!(A1, -n - 2)
@test_throws ArgumentError tril!(A1, n)
end
Expand Down Expand Up @@ -343,16 +343,16 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa
@test B'A1' B'Matrix(A1)'

if eltyB == elty1
@test A_mul_B!(zeros(B),A1,B) A1*B
@test A_mul_Bc!(zeros(B),A1,B) A1*B'
@test A_mul_Bt!(zeros(B),A1,B) A1*B.'
@test Ac_mul_B!(zeros(B),A1,B) A1'*B
@test At_mul_B!(zeros(B),A1,B) A1.'*B
@test A_mul_B!(similar(B),A1,B) A1*B
@test A_mul_Bc!(similar(B),A1,B) A1*B'
@test A_mul_Bt!(similar(B),A1,B) A1*B.'
@test Ac_mul_B!(similar(B),A1,B) A1'*B
@test At_mul_B!(similar(B),A1,B) A1.'*B
# test also vector methods
B1 = vec(B[1,:])
@test A_mul_B!(zeros(B1),A1,B1) A1*B1
@test Ac_mul_B!(zeros(B1),A1,B1) A1'*B1
@test At_mul_B!(zeros(B1),A1,B1) A1.'*B1
@test A_mul_B!(similar(B1),A1,B1) A1*B1
@test Ac_mul_B!(similar(B1),A1,B1) A1'*B1
@test At_mul_B!(similar(B1),A1,B1) A1.'*B1
end
#error handling
@test_throws DimensionMismatch Base.LinAlg.A_mul_B!(A1, ones(eltyB,n+1))
Expand Down
35 changes: 19 additions & 16 deletions test/linalg/tridiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,39 @@ guardsrand(123) do
@test Array(convert(SymTridiagonal{Complex64},Tridiagonal(SymTridiagonal(d, dl)))) == convert(Matrix{Complex64}, SymTridiagonal(d, dl))
end
@testset "tril/triu" begin
zerosd = fill!(similar(d), 0)
zerosdl = fill!(similar(dl), 0)
zerosdu = fill!(similar(du), 0)
@test_throws ArgumentError tril!(SymTridiagonal(d, dl), -n - 2)
@test_throws ArgumentError tril!(SymTridiagonal(d, dl), n)
@test_throws ArgumentError tril!(Tridiagonal(dl, d, du), -n - 2)
@test_throws ArgumentError tril!(Tridiagonal(dl, d, du), n)
@test tril(SymTridiagonal(d,dl)) == Tridiagonal(dl,d,zeros(dl))
@test tril(SymTridiagonal(d,dl)) == Tridiagonal(dl,d,zerosdl)
@test tril(SymTridiagonal(d,dl),1) == Tridiagonal(dl,d,dl)
@test tril(SymTridiagonal(d,dl),-1) == Tridiagonal(dl,zeros(d),zeros(dl))
@test tril(SymTridiagonal(d,dl),-2) == Tridiagonal(zeros(dl),zeros(d),zeros(dl))
@test tril(Tridiagonal(dl,d,du)) == Tridiagonal(dl,d,zeros(du))
@test tril(SymTridiagonal(d,dl),-1) == Tridiagonal(dl,zerosd,zerosdl)
@test tril(SymTridiagonal(d,dl),-2) == Tridiagonal(zerosdl,zerosd,zerosdl)
@test tril(Tridiagonal(dl,d,du)) == Tridiagonal(dl,d,zerosdu)
@test tril(Tridiagonal(dl,d,du),1) == Tridiagonal(dl,d,du)
@test tril(Tridiagonal(dl,d,du),-1) == Tridiagonal(dl,zeros(d),zeros(du))
@test tril(Tridiagonal(dl,d,du),-2) == Tridiagonal(zeros(dl),zeros(d),zeros(du))
@test tril(Tridiagonal(dl,d,du),-1) == Tridiagonal(dl,zerosd,zerosdu)
@test tril(Tridiagonal(dl,d,du),-2) == Tridiagonal(zerosdl,zerosd,zerosdu)

@test_throws ArgumentError triu!(SymTridiagonal(d, dl), -n)
@test_throws ArgumentError triu!(SymTridiagonal(d, dl), n + 2)
@test_throws ArgumentError triu!(Tridiagonal(dl, d, du), -n)
@test_throws ArgumentError triu!(Tridiagonal(dl, d, du), n + 2)
@test triu(SymTridiagonal(d,dl)) == Tridiagonal(zeros(dl),d,dl)
@test triu(SymTridiagonal(d,dl)) == Tridiagonal(zerosdl,d,dl)
@test triu(SymTridiagonal(d,dl),-1) == Tridiagonal(dl,d,dl)
@test triu(SymTridiagonal(d,dl),1) == Tridiagonal(zeros(dl),zeros(d),dl)
@test triu(SymTridiagonal(d,dl),2) == Tridiagonal(zeros(dl),zeros(d),zeros(dl))
@test triu(Tridiagonal(dl,d,du)) == Tridiagonal(zeros(dl),d,du)
@test triu(SymTridiagonal(d,dl),1) == Tridiagonal(zerosdl,zerosd,dl)
@test triu(SymTridiagonal(d,dl),2) == Tridiagonal(zerosdl,zerosd,zerosdl)
@test triu(Tridiagonal(dl,d,du)) == Tridiagonal(zerosdl,d,du)
@test triu(Tridiagonal(dl,d,du),-1) == Tridiagonal(dl,d,du)
@test triu(Tridiagonal(dl,d,du),1) == Tridiagonal(zeros(dl),zeros(d),du)
@test triu(Tridiagonal(dl,d,du),2) == Tridiagonal(zeros(dl),zeros(d),zeros(du))
@test triu(Tridiagonal(dl,d,du),1) == Tridiagonal(zerosdl,zerosd,du)
@test triu(Tridiagonal(dl,d,du),2) == Tridiagonal(zerosdl,zerosd,zerosdu)

@test !istril(SymTridiagonal(d,dl))
@test !istriu(SymTridiagonal(d,dl))
@test istriu(Tridiagonal(zeros(dl),d,du))
@test istril(Tridiagonal(dl,d,zeros(du)))
@test istriu(Tridiagonal(zerosdl,d,du))
@test istril(Tridiagonal(dl,d,zerosdu))
end

@testset for mat_type in (Tridiagonal, SymTridiagonal)
Expand Down Expand Up @@ -212,8 +215,8 @@ guardsrand(123) do
@test A*LowerTriangular(eye(n)) fA
end
@testset "A_mul_B! errors" begin
@test_throws DimensionMismatch Base.LinAlg.A_mul_B!(zeros(fA),A,ones(elty,n,n+1))
@test_throws DimensionMismatch Base.LinAlg.A_mul_B!(zeros(fA),A,ones(elty,n+1,n))
@test_throws DimensionMismatch Base.LinAlg.A_mul_B!(similar(fA),A,ones(elty,n,n+1))
@test_throws DimensionMismatch Base.LinAlg.A_mul_B!(similar(fA),A,ones(elty,n+1,n))
@test_throws DimensionMismatch A_mul_B!(zeros(elty,n,n),B,ones(elty,n+1,n))
@test_throws DimensionMismatch A_mul_B!(zeros(elty,n+1,n),B,ones(elty,n,n))
@test_throws DimensionMismatch A_mul_B!(zeros(elty,n,n+1),B,ones(elty,n,n))
Expand Down
6 changes: 3 additions & 3 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ end
STAA = Symmetric(TAA)
@test Array(atanh.(STAA)) == atanh.(TAA)
@test Array(asinh.(STAA)) == asinh.(TAA)
@test Array(acosh.(STAA+Symmetric(ones(TAA)))) == acosh.(TAA+ones(TAA))
@test Array(acsch.(STAA+Symmetric(ones(TAA)))) == acsch.(TAA+ones(TAA))
@test Array(acoth.(STAA+Symmetric(ones(TAA)))) == acoth.(TAA+ones(TAA))
@test Array(acosh.(STAA+Symmetric(ones(2,2)))) == acosh.(TAA+ones(2,2))
@test Array(acsch.(STAA+Symmetric(ones(2,2)))) == acsch.(TAA+ones(2,2))
@test Array(acoth.(STAA+Symmetric(ones(2,2)))) == acoth.(TAA+ones(2,2))
end

@testset "check exp2(::Integer) matches exp2(::Float)" begin
Expand Down
4 changes: 2 additions & 2 deletions test/sparse/higherorderfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ end
@test A .- 3 == AF .- 3
@test 3 .- A == 3 .- AF
@test A .- B == AF .- BF
@test A - AF == zeros(AF)
@test AF - A == zeros(AF)
@test A - AF == zeros(size(AF))
@test AF - A == zeros(size(AF))
@test A[1,:] .- B == AF[1,:] .- BF
@test A[:,1] .- B == AF[:,1] .- BF
@test A .- B[1,:] == AF .- BF[1,:]
Expand Down
4 changes: 2 additions & 2 deletions test/sparse/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1130,9 +1130,9 @@ end
sparr = Sp(arr)
fillval = rand(Tv)
fill!(sparr, fillval)
@test Array(sparr) == fillval * ones(arr)
@test Array(sparr) == fillval * ones(Tv, siz...)
fill!(sparr, 0)
@test Array(sparr) == zeros(arr)
@test Array(sparr) == zeros(Tv, siz...)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions test/sparse/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
@test x float([1:5;])

@test A*x b
z = complex.(b,zeros(b))
z = complex.(b)
x = Base.SparseArrays.A_ldiv_B!(lua, z)
@test x float([1:5;])
@test z === x
y = similar(z)
A_ldiv_B!(y, lua, complex.(b,zeros(b)))
A_ldiv_B!(y, lua, complex.(b))
@test y x

@test A*x b
Expand All @@ -45,23 +45,23 @@
@test x float([1:5;])

@test A'*x b
z = complex.(b,zeros(b))
z = complex.(b)
x = Base.SparseArrays.Ac_ldiv_B!(lua, z)
@test x float([1:5;])
@test x === z
y = similar(x)
Base.SparseArrays.Ac_ldiv_B!(y, lua, complex.(b,zeros(b)))
Base.SparseArrays.Ac_ldiv_B!(y, lua, complex.(b))
@test y x

@test A'*x b
x = lua.'\b
@test x float([1:5;])

@test A.'*x b
x = Base.SparseArrays.At_ldiv_B!(lua,complex.(b,zeros(b)))
x = Base.SparseArrays.At_ldiv_B!(lua,complex.(b))
@test x float([1:5;])
y = similar(x)
Base.SparseArrays.At_ldiv_B!(y, lua,complex.(b,zeros(b)))
Base.SparseArrays.At_ldiv_B!(y, lua,complex.(b))
@test y x

@test A.'*x b
Expand Down

0 comments on commit ffdfdc9

Please sign in to comment.