Skip to content

Commit 6b27e6f

Browse files
committed
more algorithm traits
1 parent a8488f4 commit 6b27e6f

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

src/algorithms.jl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,54 @@ right_orth_kind(alg::AbstractAlgorithm) = error(
9595
"""
9696
)
9797

98+
"""
99+
left_null_kind(alg::AbstractAlgorithm) -> f!
100+
101+
Select an appropriate factorization function for applying `left_null!(A, alg)`.
102+
By default, this is either `left_null_qr!` or `left_null_svd!`, but this can be extended
103+
to insert arbitrary other decomposition functions, which should follow the signature
104+
`f!(A, F, alg) -> F`
105+
"""
106+
function left_null_kind(alg::AbstractAlgorithm)
107+
left_orth_kind(alg) === left_orth_qr! && return left_null_qr!
108+
left_orth_kind(alg) === left_orth_svd! && return left_null_svd!
109+
return error(
110+
"""
111+
Unkown or invalid `left_null` algorithm type `$(typeof(alg))`.
112+
To register the algorithm type, define:
113+
114+
MatrixAlgebraKit.left_null_kind(alg) = f!
115+
116+
where `f!` should be the factorization function that will be used.
117+
By default, this is either `left_null_qr!` or `left_null_svd!`.
118+
"""
119+
)
120+
end
121+
122+
"""
123+
right_null_kind(alg::AbstractAlgorithm) -> f!
124+
125+
Select an appropriate factorization function for applying `right_null!(A, alg)`.
126+
By default, this is either `right_null_lq!` or `right_null_svd!`, but this can be extended
127+
to insert arbitrary other decomposition functions, which should follow the signature
128+
`f!(A, F, alg) -> F`
129+
"""
130+
function right_null_kind(alg::AbstractAlgorithm)
131+
right_orth_kind(alg) === right_orth_lq! && return right_null_lq!
132+
right_orth_kind(alg) === right_orth_svd! && return right_null_svd!
133+
return error(
134+
"""
135+
Unkown or invalid `right_null` algorithm type `$(typeof(alg))`.
136+
To register the algorithm type, define:
137+
138+
MatrixAlgebraKit.right_null_kind(alg) = f!
139+
140+
where `f!` should be the factorization function that will be used.
141+
By default, this is either `right_null_lq!` or `right_null_svd!`.
142+
"""
143+
)
144+
end
145+
98146
"""
99147
does_truncate(alg::AbstractAlgorithm) -> Bool
100148

0 commit comments

Comments
 (0)