• Calculate the LU decomposition of an NxN matrix.

    P is returned as PA = UL or A = P'UL which follows Matlab and Octave opposed to Scipy which returns P as A = PUL or P'A = UL. For matrix inverse, we need P such that PA = UL and it is faster not having to invert P, even if we can invert it fairly fast as it is just a shuffled identity matrix.

    P is returned as a permutation matrix unless pIndices is true, in which case P would be returned as a vector containing the indexes such that A[P,:] = L*U.

    Reference:

    Parameters

    • matrix: number[][]
    • Optionaloptions: {
          pIndices?: false;
      }
      • OptionalpIndices?: false

    Returns [number[][], number[][], number[][]]

  • Parameters

    • matrix: number[][]
    • Optionaloptions: {
          pIndices?: true;
      }
      • OptionalpIndices?: true

    Returns [number[], number[][], number[][]]