Skip to content

Commit 56453ad

Browse files
committed
update docs
1 parent f02e1c8 commit 56453ad

2 files changed

Lines changed: 56 additions & 9 deletions

File tree

docs/src/user_interface/decompositions.md

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ lq_full
4040
lq_compact
4141
```
4242

43-
Alongside these functions, we provide a LAPACK-based implementation for dense arrays, as provided by the following algorithm:
43+
The following algorithm is available for QR and LQ decompositions:
4444

4545
```@docs; canonical=false
46-
LAPACK_HouseholderQR
47-
LAPACK_HouseholderLQ
46+
Householder
4847
```
4948

5049
## Eigenvalue Decomposition
@@ -78,7 +77,7 @@ eigh_vals
7877
By default, MatrixAlgebraKit applies a gauge fixing convention to ensure reproducible results.
7978
See [Gauge choices](@ref sec_gaugefix) for more details.
8079

81-
Alongside these functions, we provide a LAPACK-based implementation for dense arrays, as provided by the following algorithms:
80+
The following algorithms are available for the symmetric eigenvalue decomposition:
8281

8382
```@autodocs; canonical=false
8483
Modules = [MatrixAlgebraKit]
@@ -100,7 +99,7 @@ eig_vals
10099
By default, MatrixAlgebraKit applies a gauge fixing convention to ensure reproducible results.
101100
See [Gauge choices](@ref sec_gaugefix) for more details.
102101

103-
Alongside these functions, we provide a LAPACK-based implementation for dense arrays, as provided by the following algorithms:
102+
The following algorithms are available for the non-Hermitian eigenvalue decomposition:
104103

105104
```@autodocs; canonical=false
106105
Modules = [MatrixAlgebraKit]
@@ -120,7 +119,7 @@ schur_full
120119
schur_vals
121120
```
122121

123-
The LAPACK-based implementation for dense arrays is provided by the following algorithms:
122+
The following algorithms are available for the Schur decomposition:
124123

125124
```@autodocs; canonical=false
126125
Modules = [MatrixAlgebraKit]
@@ -153,11 +152,11 @@ svd_trunc
153152
By default, MatrixAlgebraKit applies a gauge fixing convention to ensure reproducible results.
154153
See [Gauge choices](@ref sec_gaugefix) for more details.
155154

156-
MatrixAlgebraKit again ships with LAPACK-based implementations for dense arrays:
155+
The following algorithms are available for the singular value decomposition:
157156

158157
```@autodocs; canonical=false
159158
Modules = [MatrixAlgebraKit]
160-
Filter = t -> t isa Type && t <: MatrixAlgebraKit.LAPACK_SVDAlgorithm
159+
Filter = t -> t isa Type && t <: MatrixAlgebraKit.SVDAlgorithms
161160
```
162161

163162
## Polar Decomposition
@@ -388,6 +387,54 @@ norm(A * N1') < 1e-14 && norm(A * N2') < 1e-14 &&
388387
true
389388
```
390389

390+
## [Driver Selection](@id sec_driverselection)
391+
392+
!!! note "Expert use case"
393+
Selecting a specific driver is an advanced feature intended for users who need to target a specific computational backend, such as a GPU. For most use cases, the default driver selection is sufficient.
394+
395+
Each algorithm in MatrixAlgebraKit can optionally accept a `driver` keyword argument to explicitly select the computational backend.
396+
By default, the driver is set to `DefaultDriver()`, which automatically selects the most appropriate backend based on the input matrix type.
397+
The available drivers are:
398+
399+
```@docs; canonical=false
400+
MatrixAlgebraKit.DefaultDriver
401+
MatrixAlgebraKit.LAPACK
402+
MatrixAlgebraKit.CUSOLVER
403+
MatrixAlgebraKit.ROCSOLVER
404+
MatrixAlgebraKit.GLA
405+
MatrixAlgebraKit.Native
406+
```
407+
408+
For example, to force LAPACK for a generic matrix type, or to use a GPU backend:
409+
410+
```julia
411+
using MatrixAlgebraKit
412+
using MatrixAlgebraKit: LAPACK, CUSOLVER # driver types are not exported by default
413+
414+
# Default: driver is selected automatically based on the input type
415+
U, S, Vᴴ = svd_compact(A)
416+
U, S, Vᴴ = svd_compact(A; alg = SafeDivideAndConquer())
417+
418+
# Expert: explicitly select LAPACK
419+
U, S, Vᴴ = svd_compact(A; alg = SafeDivideAndConquer(; driver = LAPACK()))
420+
421+
# Expert: use a GPU backend (requires loading the appropriate extension)
422+
U, S, Vᴴ = svd_compact(A; alg = QRIteration(; driver = CUSOLVER()))
423+
```
424+
425+
Similarly, for QR decompositions:
426+
427+
```julia
428+
using MatrixAlgebraKit: LAPACK # driver types are not exported by default
429+
430+
# Default: driver is selected automatically
431+
Q, R = qr_compact(A)
432+
Q, R = qr_compact(A; alg = Householder())
433+
434+
# Expert: explicitly select a driver
435+
Q, R = qr_compact(A; alg = Householder(; driver = LAPACK()))
436+
```
437+
391438
## [Gauge choices](@id sec_gaugefix)
392439

393440
Both eigenvalue and singular value decompositions have residual gauge degrees of freedom even when the eigenvalues or singular values are unique.

src/interface/decompositions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ const GPU_Randomized = Union{CUSOLVER_Randomized}
535535

536536
const QRAlgorithms = Union{Householder, LAPACK_HouseholderQR, Native_HouseholderQR, CUSOLVER_HouseholderQR, ROCSOLVER_HouseholderQR}
537537
const LQAlgorithms = Union{Householder, LAPACK_HouseholderLQ, Native_HouseholderLQ, LQViaTransposedQR}
538-
const SVDAlgorithms = Union{LAPACK_SVDAlgorithm, GPU_SVDAlgorithm}
538+
const SVDAlgorithms = Union{SafeDivideAndConquer, DivideAndConquer, QRIteration, Bisection, Jacobi, SVDViaPolar}
539539
const PolarAlgorithms = Union{PolarViaSVD, PolarNewton}
540540

541541
# ================================

0 commit comments

Comments
 (0)