Skip to content

Commit 94d8843

Browse files
committed
Update document about SVD
1 parent 0d89696 commit 94d8843

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

lax/src/least_squares.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ pub struct LeastSquaresOutput<A: Scalar> {
1212
pub rank: i32,
1313
}
1414

15-
/// Wraps `*gelsd`
15+
#[cfg_attr(doc, katexit::katexit)]
16+
/// Solve least square problem
1617
pub trait LeastSquaresSvdDivideConquer_: Scalar {
18+
/// Compute a vector $x$ which minimizes Euclidian norm $\| Ax - b\|$
19+
/// for a given matrix $A$ and a vector $b$.
1720
fn least_squares(
1821
a_layout: MatrixLayout,
1922
a: &mut [Self],
2023
b: &mut [Self],
2124
) -> Result<LeastSquaresOutput<Self>>;
2225

26+
/// Solve least square problems $\argmin_X \| AX - B\|$
2327
fn least_squares_nrhs(
2428
a_layout: MatrixLayout,
2529
a: &mut [Self],

lax/src/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@
6161
//! - [Eig_] trait provides methods for eigenvalue problem for general matrix.
6262
//! - [Eigh_] trait provides methods for eigenvalue problem for symmetric/hermite matrix.
6363
//!
64-
//! Singular Value Decomposition (SVD), Least square problem
65-
//! ----------------------------------------------------------
64+
//! Singular Value Decomposition
65+
//! -----------------------------
6666
//!
67-
//! | matrix type | Singular Value Decomposition (SVD) | SVD with divided-and-conquer (SDD) | Least square problem (LSD) |
68-
//! |:-------------|:-----------------------------------|:-----------------------------------|:---------------------------|
69-
//! | General (GE) | [svd] | [svddc] | [least_squares] |
67+
//! - [SVD_] trait provides methods for singular value decomposition for general matrix
68+
//! - [SVDDC_] trait provides methods for singular value decomposition for general matrix
69+
//! with divided-and-conquer algorithm
70+
//! - [LeastSquaresSvdDivideConquer_] trait provides methods
71+
//! for solving least square problem by SVD
7072
//!
71-
//! [svd]: svd/trait.SVD_.html#tymethod.svd
72-
//! [svddc]: svddck/trait.SVDDC_.html#tymethod.svddc
73-
//! [least_squares]: least_squares/trait.LeastSquaresSvdDivideConquer_.html#tymethod.least_squares
7473
7574
#[cfg(any(feature = "intel-mkl-system", feature = "intel-mkl-static"))]
7675
extern crate intel_mkl_src as _src;

lax/src/svd.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ pub struct SVDOutput<A: Scalar> {
1414
pub vt: Option<Vec<A>>,
1515
}
1616

17-
/// Wraps `*gesvd`
17+
#[cfg_attr(doc, katexit::katexit)]
18+
/// Singular value decomposition
1819
pub trait SVD_: Scalar {
19-
/// Calculate singular value decomposition $ A = U \Sigma V^T $
20+
/// Compute singular value decomposition $A = U \Sigma V^T$
21+
///
22+
/// LAPACK correspondance
23+
/// ----------------------
24+
///
25+
/// | f32 | f64 | c32 | c64 |
26+
/// |:-------|:-------|:-------|:-------|
27+
/// | sgesvd | dgesvd | cgesvd | zgesvd |
28+
///
2029
fn svd(l: MatrixLayout, calc_u: bool, calc_vt: bool, a: &mut [Self])
2130
-> Result<SVDOutput<Self>>;
2231
}

lax/src/svddc.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@ use crate::{error::*, layout::MatrixLayout, *};
22
use cauchy::*;
33
use num_traits::{ToPrimitive, Zero};
44

5+
#[cfg_attr(doc, katexit::katexit)]
6+
/// Singular value decomposition with divide-and-conquer method
57
pub trait SVDDC_: Scalar {
8+
/// Compute singular value decomposition $A = U \Sigma V^T$
9+
///
10+
/// LAPACK correspondance
11+
/// ----------------------
12+
///
13+
/// | f32 | f64 | c32 | c64 |
14+
/// |:-------|:-------|:-------|:-------|
15+
/// | sgesdd | dgesdd | cgesdd | zgesdd |
16+
///
617
fn svddc(l: MatrixLayout, jobz: JobSvd, a: &mut [Self]) -> Result<SVDOutput<Self>>;
718
}
819

0 commit comments

Comments
 (0)