Skip to content

Commit 63e3ffb

Browse files
committed
Add tests and fix README
1 parent 486fd71 commit 63e3ffb

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ julia = "1.2"
1515
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
1616
BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0"
1717
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
18+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1819
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1920
SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
2021
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2122

2223
[targets]
23-
test = ["Test", "LabelledArrays", "StaticArrays", "BandedMatrices", "BlockBandedMatrices", "SuiteSparse"]
24+
test = ["Test", "LabelledArrays", "StaticArrays", "BandedMatrices", "BlockBandedMatrices", "SuiteSparse", "Random"]

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ cheaply.
6767

6868
## issingular(A)
6969

70-
Return an instance of the LU factorization object with the correct type
71-
cheaply.
70+
Check singularity by factorization or checking zeros of structured matrices.
71+
72+
*Warning*: `rank` is a better choice for some matrices.
7273

7374
## List of things to add
7475

test/runtests.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,21 @@ using SuiteSparse
141141
end
142142
@test lu_instance(1) === 1
143143
end
144+
145+
using Random
146+
using ArrayInterface: issingular
147+
@testset "issingular" begin
148+
for T in [Float64, ComplexF64]
149+
R = randn(MersenneTwister(2), T, 5, 5)
150+
S = Symmetric(R)
151+
L = UpperTriangular(R)
152+
U = LowerTriangular(R)
153+
@test all(!issingular, [R, S, L, U])
154+
R[:, 2] .= 0
155+
@test all(issingular, [R, L, U])
156+
@test !issingular(S)
157+
R[2, :] .= 0
158+
@test issingular(S)
159+
@test all(!issingular, [UnitLowerTriangular(R), UnitUpperTriangular(R)])
160+
end
161+
end

0 commit comments

Comments
 (0)