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

    Function chol

    • Cholesky decomposition. Equivalent to R's chol().

      Returns the upper triangular R with x = t(R) R. Only the upper triangle of x is used (symmetry is not checked), and the lower triangle of the result is zero. Throws if x is not positive definite.

      Parameters

      Returns number[][]

      The upper triangular factor R as an array of rows.

      chol([[4, 2], [2, 3]]);
      // [[2, 1], [0, 1.4142135623730951]]
    • Pivoted Cholesky decomposition, as R's chol(x, pivot = TRUE).

      Does not throw for rank-deficient (positive semi-definite) matrices; check rank instead (R gives a warning). As in R 4.6, the trailing submatrix of r from row and column rank on is 0, so that x[pivot, pivot] = t(R) R holds for a positive semi-definite x.

      Parameters

      • x: MatrixInput

        A square symmetric matrix (array of rows). Only the upper triangle is used.

      • options: CholOptions & { pivot: true }

        See CholOptions; pivot must be true.

      Returns CholPivotResult

      The factor, the 0-based pivot and the rank. See CholPivotResult.

      chol([[1, 1], [1, 1]], { pivot: true });
      // { r: [[1, 1], [0, 0]], pivot: [0, 1], rank: 1 }
    • Cholesky decomposition, with or without pivoting.

      Parameters

      Returns number[][] | CholPivotResult

      The factor R, or a CholPivotResult when pivot is true.