Skip to content

Commit 73444c7

Browse files
committed
Add tests for the utility function
1 parent b45c914 commit 73444c7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/dense.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,4 +1377,23 @@ end
13771377
@test_throws "matrix is singular; factorization failed" inv(A)
13781378
end
13791379

1380+
@testset "copytri_maybe_inplace" begin
1381+
R = reshape(1:16,4,4)
1382+
for conjugate in [true, false], diag in [true, false]
1383+
@test LinearAlgebra.copytri_maybe_inplace(R, 'U', conjugate, diag) == Symmetric(R, :U)
1384+
@test LinearAlgebra.copytri_maybe_inplace(R, 'L', conjugate, diag) == Symmetric(R, :L)
1385+
end
1386+
1387+
Rc = reshape(StepRangeLen(1+2im, 3 + 4im, 16), 4, 4)
1388+
Ac = Array(Rc)
1389+
@testset for conjugate in [true, false], diag in [true, false]
1390+
tR = LinearAlgebra.copytri_maybe_inplace(Rc, 'U', conjugate, diag)
1391+
tA = LinearAlgebra.copytri_maybe_inplace(copy(Ac), 'U', conjugate, diag)
1392+
@test tR == tA
1393+
tR = LinearAlgebra.copytri_maybe_inplace(Rc, 'L', conjugate, diag)
1394+
tA = LinearAlgebra.copytri_maybe_inplace(copy(Ac), 'L', conjugate, diag)
1395+
@test tR == tA
1396+
end
1397+
end
1398+
13801399
end # module TestDense

0 commit comments

Comments
 (0)