Skip to content

Commit c31d563

Browse files
committed
docs improvements
1 parent 089280f commit c31d563

3 files changed

Lines changed: 60 additions & 93 deletions

File tree

ext/MatrixAlgebraKitCUDAExt/yacusolver.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ function gesvdp!(
164164
)
165165
end
166166
err = h_err_sigma[]
167-
if err > tol
168-
warn("gesvdp! did not attained requested tolerance: error = $err > tolerance = $tol")
169-
end
167+
err > tol && @warn "gesvdp! did not attain the requested tolerance: error = $err > tolerance = $tol"
170168

171169
flag = @allowscalar dh.info[1]
172170
CUSOLVER.chklapackerror(BlasInt(flag))

src/common/defaults.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ function default_fixgauge(new_value::Bool)
5959
DEFAULT_FIXGAUGE[] = new_value
6060
return previous_value
6161
end
62+
63+
const _fixgauge_docs = "The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the output, see also [`default_fixgauge`](@ref) for a global toggle and [`gaugefix!`](@ref) for implementation details."

src/interface/decompositions.jl

Lines changed: 57 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ of `R` are non-negative.
6060
"""
6161
@algdef GLA_HouseholderQR
6262

63-
# TODO:
6463
@algdef LAPACK_HouseholderQL
6564
@algdef LAPACK_HouseholderRQ
6665

@@ -86,38 +85,26 @@ function Householder(;
8685
return Householder((; blocksize, driver, pivoted, positive))
8786
end
8887

89-
default_householder_driver(A) = default_householder_driver(typeof(A))
90-
default_householder_driver(::Type) = Native()
91-
92-
default_householder_driver(::Type{A}) where {A <: YALAPACK.MaybeBlasMat} = LAPACK()
93-
94-
# note: StridedVector fallback is needed for handling reshaped parent types
95-
default_householder_driver(::Type{A}) where {A <: StridedVector{<:BlasFloat}} = LAPACK()
96-
default_householder_driver(::Type{<:SubArray{T, N, A}}) where {T, N, A} =
97-
default_householder_driver(A)
98-
default_householder_driver(::Type{<:Base.ReshapedArray{T, N, A}}) where {T, N, A} =
99-
default_householder_driver(A)
100-
10188
"""
102-
DivideAndConquer(; [driver], fixgauge=default_fixgauge())
89+
DivideAndConquer(; [driver], fixgauge = default_fixgauge())
10390
10491
Algorithm type to denote the algorithm for computing the eigenvalue decomposition of a Hermitian matrix,
10592
or the singular value decomposition of a general matrix using the divide-and-conquer algorithm.
10693
10794
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
108-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`default_fixgauge`](@ref) and [`gaugefix!`](@ref).
95+
$_fixgauge_docs
10996
"""
11097
@algdef DivideAndConquer
11198

11299
"""
113-
SafeDivideAndConquer(; [driver], kwargs...)
100+
SafeDivideAndConquer(; [driver], fixgauge = default_fixgauge())
114101
115102
Algorithm type to for computing the eigenvalue decomposition of a Hermitian matrix,
116103
or the singular value decomposition of a general matrix using the divide-and-conquer algorithm,
117104
with an additional fallback to the standard QR iteration algorithm in case the former fails to converge.
118105
119106
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
120-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`gaugefix!`](@ref).
107+
$_fixgauge_docs
121108
122109
!!! warning
123110
This approach requires a copy of the input matrix, and is thus the most memory intensive SVD strategy.
@@ -129,46 +116,47 @@ See also [`DivideAndConquer`](@ref) and [`QRIteration`](@ref).
129116
@algdef SafeDivideAndConquer
130117

131118
"""
132-
QRIteration(; [driver], fixgauge = true)
119+
QRIteration(; [driver], fixgauge = default_fixgauge())
133120
134121
Algorithm type for computing the eigenvalue decomposition of a Hermitian matrix,
135122
or the singular value decomposition of a general matrix via QR iteration.
136123
137124
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
138-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`gaugefix!`](@ref).
125+
$_fixgauge_docs
139126
"""
140127
@algdef QRIteration
141128

142129
"""
143-
Bisection(; [driver], fixgauge::Bool = true)
130+
Bisection(; [driver], fixgauge = default_fixgauge())
144131
145132
Algorithm type for computing the eigenvalue decomposition of a Hermitian matrix,
146133
or the singular value decomposition of a general matrix via the bisection algorithm.
147134
148135
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
149-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`gaugefix!`](@ref).
136+
$_fixgauge_docs
150137
"""
151138
@algdef Bisection
152139

153140
"""
154-
Jacobi(; [driver], fixgauge = true)
141+
Jacobi(; [driver], fixgauge = default_fixgauge())
155142
156143
Algorithm type for computing the singular value decomposition of a general matrix using the Jacobi algorithm.
157144
158145
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
159-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`gaugefix!`](@ref).
146+
$_fixgauge_docs
160147
"""
161148
@algdef Jacobi
162149

163150
"""
164-
SVDViaPolar(; [driver], kwargs...)
151+
SVDViaPolar(; [driver], fixgauge = default_fixgauge(), [tol])
165152
166153
Algorithm type to denote the algorithm for computing the singular value decomposition of a general
167154
matrix via Halley's iterative algorithm for the polar decomposition followed by the Hermitian
168155
eigenvalue decomposition of the positive definite factor.
169156
170157
The optional `driver` symbol can be used to choose between different implementations of this algorithm.
171-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or singular vectors, see also [`gaugefix!`](@ref).
158+
$_fixgauge_docs
159+
The tolerance `tol` can optionally be used to emit a warning if the decomposition failed to converge beyond that given value.
172160
"""
173161
@algdef SVDViaPolar
174162

@@ -195,22 +183,20 @@ end
195183
# General Eigenvalue Decomposition
196184
# -------------------------------
197185
"""
198-
LAPACK_Simple(; fixgauge::Bool = true)
186+
LAPACK_Simple(; fixgauge = default_fixgauge())
199187
200188
Algorithm type to denote the simple LAPACK driver for computing the Schur or non-Hermitian
201189
eigenvalue decomposition of a matrix.
202-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigenvectors,
203-
see also [`gaugefix!`](@ref).
190+
$_fixgauge_docs
204191
"""
205192
@algdef LAPACK_Simple
206193

207194
"""
208-
LAPACK_Expert(; fixgauge::Bool = true)
195+
LAPACK_Expert(; fixgauge = default_fixgauge())
209196
210197
Algorithm type to denote the expert LAPACK driver for computing the Schur or non-Hermitian
211198
eigenvalue decomposition of a matrix.
212-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigenvectors,
213-
see also [`gaugefix!`](@ref).
199+
$_fixgauge_docs
214200
"""
215201
@algdef LAPACK_Expert
216202

@@ -227,45 +213,38 @@ eigenvalue decomposition of a non-Hermitian matrix.
227213
# Hermitian Eigenvalue Decomposition
228214
# ----------------------------------
229215
"""
230-
LAPACK_QRIteration(; fixgauge::Bool = true)
216+
LAPACK_QRIteration(; fixgauge = default_fixgauge())
231217
232-
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a
233-
Hermitian matrix, or the singular value decomposition of a general matrix using the
234-
QR Iteration algorithm.
235-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
236-
singular vectors, see also [`gaugefix!`](@ref).
218+
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a Hermitian matrix,
219+
or the singular value decomposition of a general matrix using the QR Iteration algorithm.
220+
$_fixgauge_docs
237221
"""
238222
@algdef LAPACK_QRIteration
239223

240224
"""
241-
LAPACK_Bisection(; fixgauge::Bool = true)
225+
LAPACK_Bisection(; fixgauge = default_fixgauge())
242226
243-
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a
244-
Hermitian matrix, or the singular value decomposition of a general matrix using the
245-
Bisection algorithm.
246-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
247-
singular vectors, see also [`gaugefix!`](@ref).
227+
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a Hermitian matrix,
228+
or the singular value decomposition of a general matrix using the Bisection algorithm.
229+
$_fixgauge_docs
248230
"""
249231
@algdef LAPACK_Bisection
250232

251233
"""
252-
LAPACK_DivideAndConquer(; fixgauge::Bool = true)
234+
LAPACK_DivideAndConquer(; fixgauge = default_fixgauge())
253235
254-
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a
255-
Hermitian matrix, or the singular value decomposition of a general matrix using the
256-
Divide and Conquer algorithm.
257-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
258-
singular vectors, see also [`gaugefix!`](@ref).
236+
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a Hermitian matrix,
237+
or the singular value decomposition of a general matrix using the Divide and Conquer algorithm.
238+
$_fixgauge_docs
259239
"""
260240
@algdef LAPACK_DivideAndConquer
261241

262242
"""
263-
LAPACK_MultipleRelativelyRobustRepresentations(; fixgauge::Bool = true)
243+
LAPACK_MultipleRelativelyRobustRepresentations(; fixgauge = default_fixgauge())
264244
265-
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a
266-
Hermitian matrix using the Multiple Relatively Robust Representations algorithm.
267-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigenvectors,
268-
see also [`gaugefix!`](@ref).
245+
Algorithm type to denote the LAPACK driver for computing the eigenvalue decomposition of a Hermitian matrix
246+
using the Multiple Relatively Robust Representations algorithm.
247+
$_fixgauge_docs
269248
"""
270249
@algdef LAPACK_MultipleRelativelyRobustRepresentations
271250

@@ -277,26 +256,24 @@ const LAPACK_EighAlgorithm = Union{
277256
}
278257

279258
"""
280-
GLA_QRIteration(; fixgauge::Bool = true)
259+
GLA_QRIteration(; fixgauge = default_fixgauge())
281260
282261
Algorithm type to denote the GenericLinearAlgebra.jl implementation for computing the
283262
eigenvalue decomposition of a Hermitian matrix, or the singular value decomposition of
284263
a general matrix.
285-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
286-
singular vectors, see also [`gaugefix!`](@ref).
264+
$_fixgauge_docs
287265
"""
288266
@algdef GLA_QRIteration
289267

290268
# Singular Value Decomposition
291269
# ----------------------------
292270
"""
293-
LAPACK_SafeDivideAndConquer(; fixgauge::Bool = true)
271+
LAPACK_SafeDivideAndConquer(; fixgauge = default_fixgauge())
294272
295273
Algorithm type to denote the LAPACK driver for computing the singular value decomposition of
296274
a general matrix using the Divide and Conquer algorithm, with an additional fallback to
297275
the standard QR Iteration algorithm in case the former fails to converge.
298-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the singular vectors,
299-
see also [`gaugefix!`](@ref).
276+
$_fixgauge_docs
300277
301278
!!! warning
302279
This approach requires a copy of the input matrix, and is thus the most memory intensive SVD strategy.
@@ -306,12 +283,11 @@ see also [`gaugefix!`](@ref).
306283
@algdef LAPACK_SafeDivideAndConquer
307284

308285
"""
309-
LAPACK_Jacobi(; fixgauge::Bool = true)
286+
LAPACK_Jacobi(; fixgauge = default_fixgauge())
310287
311288
Algorithm type to denote the LAPACK driver for computing the singular value decomposition of
312289
a general matrix using the Jacobi algorithm.
313-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the singular vectors,
314-
see also [`gaugefix!`](@ref).
290+
$_fixgauge_docs
315291
"""
316292
@algdef LAPACK_Jacobi
317293

@@ -384,34 +360,31 @@ the diagonal elements of `R` are non-negative.
384360
@algdef CUSOLVER_HouseholderQR
385361

386362
"""
387-
CUSOLVER_QRIteration(; fixgauge::Bool = true)
363+
CUSOLVER_QRIteration(; fixgauge = default_fixgauge())
388364
389365
Algorithm type to denote the CUSOLVER driver for computing the eigenvalue decomposition of a
390366
Hermitian matrix, or the singular value decomposition of a general matrix using the
391367
QR Iteration algorithm.
392-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
393-
singular vectors, see also [`gaugefix!`](@ref).
368+
$_fixgauge_docs
394369
"""
395370
@algdef CUSOLVER_QRIteration
396371

397372
"""
398-
CUSOLVER_SVDPolar(; fixgauge::Bool = true)
373+
CUSOLVER_SVDPolar(; fixgauge = default_fixgauge())
399374
400375
Algorithm type to denote the CUSOLVER driver for computing the singular value decomposition of
401376
a general matrix by using Halley's iterative algorithm to compute the polar decompositon,
402377
followed by the hermitian eigenvalue decomposition of the positive definite factor.
403-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the singular
404-
vectors, see also [`gaugefix!`](@ref).
378+
$_fixgauge_docs
405379
"""
406380
@algdef CUSOLVER_SVDPolar
407381

408382
"""
409-
CUSOLVER_Jacobi(; fixgauge::Bool = true)
383+
CUSOLVER_Jacobi(; fixgauge = default_fixgauge())
410384
411385
Algorithm type to denote the CUSOLVER driver for computing the singular value decomposition of
412386
a general matrix using the Jacobi algorithm.
413-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the singular
414-
vectors, see also [`gaugefix!`](@ref).
387+
$_fixgauge_docs
415388
"""
416389
@algdef CUSOLVER_Jacobi
417390

@@ -433,25 +406,23 @@ for more information.
433406
does_truncate(::TruncatedAlgorithm{<:CUSOLVER_Randomized}) = true
434407

435408
"""
436-
CUSOLVER_Simple(; fixgauge::Bool = true)
409+
CUSOLVER_Simple(; fixgauge = default_fixgauge())
437410
438411
Algorithm type to denote the simple CUSOLVER driver for computing the non-Hermitian
439412
eigenvalue decomposition of a matrix.
440-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigenvectors,
441-
see also [`gaugefix!`](@ref).
413+
$_fixgauge_docs
442414
"""
443415
@algdef CUSOLVER_Simple
444416

445417
const CUSOLVER_EigAlgorithm = Union{CUSOLVER_Simple}
446418

447419
"""
448-
CUSOLVER_DivideAndConquer(; fixgauge::Bool = true)
420+
CUSOLVER_DivideAndConquer(; fixgauge = default_fixgauge())
449421
450422
Algorithm type to denote the CUSOLVER driver for computing the eigenvalue decomposition of a
451423
Hermitian matrix, or the singular value decomposition of a general matrix using the
452424
Divide and Conquer algorithm.
453-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
454-
singular vectors, see also [`gaugefix!`](@ref).
425+
$_fixgauge_docs
455426
"""
456427
@algdef CUSOLVER_DivideAndConquer
457428

@@ -472,45 +443,41 @@ the diagonal elements of `R` are non-negative.
472443
@algdef ROCSOLVER_HouseholderQR
473444

474445
"""
475-
ROCSOLVER_QRIteration(; fixgauge::Bool = true)
446+
ROCSOLVER_QRIteration(; fixgauge = default_fixgauge())
476447
477448
Algorithm type to denote the ROCSOLVER driver for computing the eigenvalue decomposition of a
478449
Hermitian matrix, or the singular value decomposition of a general matrix using the
479450
QR Iteration algorithm.
480-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
481-
singular vectors, see also [`gaugefix!`](@ref).
451+
$_fixgauge_docs
482452
"""
483453
@algdef ROCSOLVER_QRIteration
484454

485455
"""
486-
ROCSOLVER_Jacobi(; fixgauge::Bool = true)
456+
ROCSOLVER_Jacobi(; fixgauge = default_fixgauge())
487457
488458
Algorithm type to denote the ROCSOLVER driver for computing the singular value decomposition of
489459
a general matrix using the Jacobi algorithm.
490-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the singular
491-
vectors, see also [`gaugefix!`](@ref).
460+
$_fixgauge_docs
492461
"""
493462
@algdef ROCSOLVER_Jacobi
494463

495464
"""
496-
ROCSOLVER_Bisection(; fixgauge::Bool = true)
465+
ROCSOLVER_Bisection(; fixgauge = default_fixgauge())
497466
498467
Algorithm type to denote the ROCSOLVER driver for computing the eigenvalue decomposition of a
499468
Hermitian matrix, or the singular value decomposition of a general matrix using the
500469
Bisection algorithm.
501-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
502-
singular vectors, see also [`gaugefix!`](@ref).
470+
$_fixgauge_docs
503471
"""
504472
@algdef ROCSOLVER_Bisection
505473

506474
"""
507-
ROCSOLVER_DivideAndConquer(; fixgauge::Bool = true)
475+
ROCSOLVER_DivideAndConquer(; fixgauge = default_fixgauge())
508476
509477
Algorithm type to denote the ROCSOLVER driver for computing the eigenvalue decomposition of a
510478
Hermitian matrix, or the singular value decomposition of a general matrix using the
511479
Divide and Conquer algorithm.
512-
The `fixgauge` keyword can be used to toggle whether or not to fix the gauge of the eigen or
513-
singular vectors, see also [`gaugefix!`](@ref).
480+
$_fixgauge_docs
514481
"""
515482
@algdef ROCSOLVER_DivideAndConquer
516483

0 commit comments

Comments
 (0)