jax-js
    Preparing search index...
    • LU decomposition with partial pivoting.

      Computes the matrix decomposition: P @ A = L @ U, where P is a permutation of the rows of A, L is lower-triangular with unit diagonal, and U is upper-triangular.

      Parameters

      • x: ArrayLike

        A batch of matrices with shape [..., m, n].

      Returns [Array, Array, Array]

      A tuple (lu, pivots, permutation) where:

      • lu: combined lower and upper triangular matrices.
      • pivots: an array of pivot indices with shape [..., min(m, n)].
      • permutation: the permutation generated by pivots with shape [..., m].
      import { lax, numpy as np } from "@jax-js/jax";

      const A = np.array([[4., 3.], [6., 3.]]);
      const [lu, pivots, permutation] = lax.linalg.lu(A);
      // lu ≈ [[6., 3.], [0.6666667, 1.0]]
      // pivots = [1, 1]
      // permutation = [1, 0]