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

    Function ginv

    • Moore-Penrose generalized inverse. Equivalent to MASS::ginv() in R.

      Computed from the singular value decomposition; singular values not greater than tol times the largest singular value are treated as zero.

      Parameters

      • x: MatrixInput

        A matrix (array of rows).

      • options: { tol?: number } = {}

        tol: relative tolerance for treating singular values as zero. Default: sqrt(Number.EPSILON).

      Returns number[][]

      The generalized inverse (ncol x nrow) as an array of rows.

      ginv([[1, 2], [3, 4]]); // [[-2, 1], [1.5, -0.5]]
      ginv([[1, 1], [1, 1]]); // [[0.25, 0.25], [0.25, 0.25]]