Function svdLAS2

Source
pub fn svdLAS2(
    A: &dyn SMat,
    dimensions: usize,
    iterations: usize,
    end_interval: &[f64; 2],
    kappa: f64,
    random_seed: u32,
) -> Result<SvdRec, SvdLibError>
Expand description

Compute a singular value decomposition

§Parameters

  • A: Sparse matrix
  • dimensions: Upper limit of desired number of dimensions (0 = max), where “max” is a value bounded by the matrix shape, the smaller of the matrix rows or columns. e.g. A.nrows().min(A.ncols())
  • iterations: Upper limit of desired number of lanczos steps (0 = max), where “max” is a value bounded by the matrix shape, the smaller of the matrix rows or columns. e.g. A.nrows().min(A.ncols()) iterations must also be in range [dimensions, A.nrows().min(A.ncols())]
  • end_interval: Left, right end of interval containing unwanted eigenvalues, typically small values centered around zero, e.g. [-1.0e-30, 1.0e-30]
  • kappa: Relative accuracy of ritz values acceptable as eigenvalues, e.g. 1.0e-6
  • random_seed: A supplied seed if > 0, otherwise an internal seed will be generated

§More on dimensions, iterations and bounding by the input matrix shape:

let min_nrows_ncols = A.nrows().min(A.ncols()); // The smaller of rows, columns

dimensions will be adjusted to min_nrows_ncols if dimensions == 0 or dimensions > min_nrows_ncols

The algorithm begins with the following assertion on dimensions:

§assert!(dimensions > 1 && dimensions <= min_nrows_ncols);

iterations will be adjusted to min_nrows_ncols if iterations == 0 or iterations > min_nrows_ncols

iterations will be adjusted to dimensions if iterations < dimensions

The algorithm begins with the following assertion on iterations:

§assert!(iterations >= dimensions && iterations <= min_nrows_ncols);

§Returns

Ok(SvdRec) on successful decomposition