Trait totsu::linalg::LinAlgEx[][src]

pub trait LinAlgEx<F: Float>: LinAlg<F> + Clone {
    fn transform_ge(
        transpose: bool,
        n_row: usize,
        n_col: usize,
        alpha: F,
        mat: &[F],
        x: &[F],
        beta: F,
        y: &mut [F]
    );
fn transform_sp(
        n: usize,
        alpha: F,
        mat: &[F],
        x: &[F],
        beta: F,
        y: &mut [F]
    );
fn proj_psd_worklen(sn: usize) -> usize;
fn proj_psd(x: &mut [F], eps_zero: F, work: &mut [F]);
fn sqrt_spmat_worklen(n: usize) -> usize;
fn sqrt_spmat(mat: &mut [F], eps_zero: F, work: &mut [F]); }
Expand description

Linear algebra extended subtrait

Required methods

Calculate \(\alpha G x + \beta y\).

  • If transpose is true, Calculate \(\alpha G^T x + \beta y\) instead.
  • alpha is a scalar \(\alpha\).
  • n_row is a number of rows of \(G\).
  • n_col is a number of columns of \(G\).
  • mat is a matrix \(G\), stored in column-major. The length of mat shall be n_row * n_col.
  • x is a vector \(x\). The length of x shall be n_col (or n_row if transpose is true).
  • beta is a scalar \(\beta\).
  • y is a vector \(y\) before entry, \(\alpha G x + \beta y\) (or \(\alpha G^T x + \beta y\) if transpose is true) on exit. The length of y shall be n_row (or n_col if transpose is true).

Calculate \(\alpha S x + \beta y\), where \(S\) is a symmetric matrix, supplied in packed form.

  • n is a number of rows and columns of \(S\).
  • alpha is a scalar \(\alpha\).
  • mat is a matrix \(S\), stored in packed form (the upper-triangular part in column-wise). The length of mat shall be n * (n + 1) / 2.
  • x is a vector \(x\). The length of x shall be n.
  • beta is a scalar \(\beta\).
  • y is a vector \(y\) before entry, \(\alpha S x + \beta y\) on exit. The length of y shall be n.

Query of a length of work slice that LinAlgEx::proj_psd requires.

Returns a length of work slice.

Euclidean projection \(x\) onto \({\rm vec}(\mathcal{S}_+^k)\).

  • x is \(x\), a vector to be projected before entry, and shall be replaced with the projected vector on exit. The length of x shall be \(\frac12k(k+1)\)
  • eps_zero shall be the same value as crate::solver::SolverParam::eps_zero.
  • work slice is used for temporal variables.

Query of a length of work slice that LinAlgEx::sqrt_spmat requires.

Returns a length of work slice.

Calculate \(S^{\frac12}\), where \(S \in \mathcal{S}_+^n\), supplied in packed form.

  • mat is a matrix \(S\) before entry, \(S^{\frac12}\) on exit. It shall be stored in packed form (the upper-triangular part in column-wise). The length of mat shall be \(\frac12n(n+1)\).
  • eps_zero should be the same value as crate::solver::SolverParam::eps_zero.
  • work slice is used for temporal variables.

Implementors