Skip to content

Commit cc74b85

Browse files
committed
Change maxrank to maxnullity in null methods
1 parent 8fd5a1d commit cc74b85

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/implementations/orthnull.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ end
156156

157157
# Implementation of null functions
158158
# --------------------------------
159-
function null_truncation_strategy(; atol=nothing, rtol=nothing, maxrank=nothing)
160-
if isnothing(maxrank) && isnothing(atol) && isnothing(rtol)
159+
function null_truncation_strategy(; atol=nothing, rtol=nothing, maxnullity=nothing)
160+
if isnothing(maxnullity) && isnothing(atol) && isnothing(rtol)
161161
return NoTruncation()
162162
end
163163
atol = @something atol 0
164164
rtol = @something rtol 0
165165
trunc = TruncationKeepBelow(atol, rtol)
166-
return !isnothing(maxrank) ? trunc & truncrank(maxrank; rev=false) : trunc
166+
return !isnothing(maxnullity) ? trunc & truncrank(maxnullity; rev=false) : trunc
167167
end
168168

169169
function left_null!(A::AbstractMatrix, N; trunc=nothing,

src/interface/orthnull.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ that should be used to factor `A`, whereas `trunc` can be used to control the
149149
the rank of `A` via its singular values.
150150
151151
`trunc` can either be a truncation strategy object or a NamedTuple with fields
152-
`atol`, `rtol`, and `maxrank`.
152+
`atol`, `rtol`, and `maxnullity`.
153153
154154
This is a high-level wrapper and will use one of the decompositions `qr!` or `svd!`
155155
to compute the orthogonal basis `N`, as controlled by the keyword arguments.
@@ -199,7 +199,7 @@ that should be used to factor `A`, whereas `trunc` can be used to control the
199199
the rank of `A` via its singular values.
200200
201201
`trunc` can either be a truncation strategy object or a NamedTuple with fields
202-
`atol`, `rtol`, and `maxrank`.
202+
`atol`, `rtol`, and `maxnullity`.
203203
204204
This is a high-level wrapper and will use one of the decompositions `lq!` or `svd!`
205205
to compute the orthogonal basis `Nᴴ`, as controlled by the keyword arguments.

test/orthnull.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ using MatrixAlgebraKit: TruncationKeepAbove, TruncationKeepBelow
2323
@test N' * N ≈ I
2424
@test V * V' + N * N' ≈ I
2525
26+
if m > n
27+
nullity = 5
28+
V, C = @constinferred left_orth(A)
29+
N = @constinferred left_null(A; trunc=(; maxnullity=nullity))
30+
@test V isa Matrix{T} && size(V) == (m, minmn)
31+
@test C isa Matrix{T} && size(C) == (minmn, n)
32+
@test N isa Matrix{T} && size(N) == (m, nullity)
33+
@test V * C ≈ A
34+
@test V' * V I
35+
@test LinearAlgebra.norm(A' * N) ≈ 0 atol = MatrixAlgebraKit.defaulttol(T)
36+
@test N' * N I
37+
end
38+
2639
for alg_qr in ((; positive=true), (; positive=false), LAPACK_HouseholderQR())
2740
V, C = @constinferred left_orth(A; alg_qr)
2841
N = @constinferred left_null(A; alg_qr)

0 commit comments

Comments
 (0)