rStats.js v1.3.0
    Preparing search index...

    Function svd

    • Singular value decomposition. Equivalent to R's svd().

      Uses the Golub-Reinsch algorithm, while R uses LAPACK's dgesdd. Singular values agree with R up to rounding, but the signs of singular vectors may differ from R (both are correct); for repeated singular values the vectors may span the same subspace with a different basis. Singular vectors beyond min(nrow, ncol) are a basis of the orthogonal complement and do not match R. Throws on NaN or infinite values.

      Parameters

      Returns SvdResult

      The singular values and vectors. See SvdResult.

      svd([[3, 0], [0, 4]]);
      // { d: [4, 3], u: [[0, 1], [1, 0]], v: [[0, 1], [1, 0]] } (signs of u and v may differ from R)