Skip to content

Commit 2b91b2f

Browse files
committed
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/sparse/sparse.jl as *, /, \, mul!, ldiv!, or rdiv!.
1 parent b306292 commit 2b91b2f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/sparse/sparse.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
using Base.LinAlg: mul!, ldiv!, rdiv!, Adjoint, Transpose
4+
35
@testset "issparse" begin
46
@test issparse(sparse(ones(5,5)))
57
@test !issparse(ones(5,5))
@@ -191,10 +193,10 @@ end
191193
α = rand(Complex128)
192194
β = rand(Complex128)
193195
@test (maximum(abs.(a*b - Array(a)*b)) < 100*eps())
194-
@test (maximum(abs.(A_mul_B!(similar(b), a, b) - Array(a)*b)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
195-
@test (maximum(abs.(A_mul_B!(similar(c), a, c) - Array(a)*c)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
196-
@test (maximum(abs.(At_mul_B!(similar(b), a, b) - Array(a).'*b)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
197-
@test (maximum(abs.(At_mul_B!(similar(c), a, c) - Array(a).'*c)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
196+
@test (maximum(abs.(mul!(similar(b), a, b) - Array(a)*b)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
197+
@test (maximum(abs.(mul!(similar(c), a, c) - Array(a)*c)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
198+
@test (maximum(abs.(mul!(similar(b), Transpose(a), b) - Array(a).'*b)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
199+
@test (maximum(abs.(mul!(similar(c), Transpose(a), c) - Array(a).'*c)) < 100*eps()) # for compatibility with present matmul API. Should go away eventually.
198200
@test (maximum(abs.(a'b - Array(a)'b)) < 100*eps())
199201
@test (maximum(abs.(a.'b - Array(a).'b)) < 100*eps())
200202
@test (maximum(abs.(a\b - Array(a)\b)) < 1000*eps())
@@ -340,11 +342,11 @@ dA = Array(sA)
340342
bi = inv.(b)
341343
dAt = transpose(dA)
342344
sAt = transpose(sA)
343-
@test scale!(copy(dAt), bi) Base.LinAlg.A_rdiv_B!(copy(sAt), Diagonal(b))
344-
@test scale!(copy(dAt), bi) Base.LinAlg.A_rdiv_Bt!(copy(sAt), Diagonal(b))
345-
@test scale!(copy(dAt), conj(bi)) Base.LinAlg.A_rdiv_Bc!(copy(sAt), Diagonal(b))
346-
@test_throws DimensionMismatch Base.LinAlg.A_rdiv_B!(copy(sAt), Diagonal(ones(length(b) + 1)))
347-
@test_throws LinAlg.SingularException Base.LinAlg.A_rdiv_B!(copy(sAt), Diagonal(zeros(length(b))))
345+
@test scale!(copy(dAt), bi) rdiv!(copy(sAt), Diagonal(b))
346+
@test scale!(copy(dAt), bi) rdiv!(copy(sAt), Transpose(Diagonal(b)))
347+
@test scale!(copy(dAt), conj(bi)) rdiv!(copy(sAt), Adjoint(Diagonal(b)))
348+
@test_throws DimensionMismatch rdiv!(copy(sAt), Diagonal(ones(length(b) + 1)))
349+
@test_throws LinAlg.SingularException rdiv!(copy(sAt), Diagonal(zeros(length(b))))
348350
end
349351
end
350352

@@ -1842,7 +1844,7 @@ end
18421844
m = 5
18431845
intmat = fill(1, m, m)
18441846
ltintmat = LowerTriangular(rand(1:5, m, m))
1845-
@test At_ldiv_B(ltintmat, sparse(intmat)) At_ldiv_B(ltintmat, intmat)
1847+
@test \(Transpose(ltintmat), sparse(intmat)) \(Transpose(ltintmat), intmat)
18461848
end
18471849

18481850
# Test temporary fix for issue #16548 in PR #16979. Somewhat brittle. Expect to remove with `\` revisions.

0 commit comments

Comments
 (0)