Skip to content

Commit 2e42ffa

Browse files
authored
Merge pull request #69 from IntegralEquations/zero-rkmatrix
Test aca on zero matrix
2 parents 11bd965 + 5585438 commit 2e42ffa

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "HMatrices"
22
uuid = "8646bddf-ab1c-4fa7-9c51-ba187d647618"
3-
version = "0.2.8"
3+
version = "0.2.9"
44

55
[deps]
66
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

src/compressor.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ function _aca_partial(K, irange, jrange, atol, rmax, rtol, istart, buffer_ = not
134134
if svdvals(δ)[end] == 0
135135
@debug "zero pivot found during partial aca"
136136
i = findfirst(x -> x == true, I)
137+
if isnothing(i)
138+
# ran out of candidate rows. Good case: the matrix is zero. Bad
139+
# case: aca failed
140+
all(j -> iszero(K[first(irange), j]), jrange) &&
141+
all(i -> iszero(K[i, first(jrange)]), irange) ||
142+
@warn "aca possibly failed on $irange × $jrange"
143+
break
144+
end
137145
else # δ != 0
138146
= inv(δ)
139147
# rdiv!(b,δ) # b <-- b/δ

test/compressor_test.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Random.seed!(1)
3131
R = aca(M, irange, jrange)
3232
@test rank(R) == r
3333

34+
# test zero matrix
35+
R = aca(zero(M), irange, jrange)
36+
@test norm(Matrix(R)) 0.0
37+
3438
# test fast update of frobenius norm
3539
m, n = 10000, 1000
3640
r = 10

0 commit comments

Comments
 (0)