Datalens.ai
← All algorithms

DECOMPOSITION

lu

Compute LU decomposition of a matrix with partial pivoting.

Example of usage

Factorise a labelled industrial sensor calibration matrix and verify reconstruction.

Usage / limitations

+Use when: Solve batches of coupled linear equations.

−Limitations: Matrix shape, symmetry, conditioning and numerical precision constrain validity.

Mathematical formula

A = PLU.
Sample dataShow
{
  "variable": "measurement_matrix",
  "domain": "Industrial sensor calibration",
  "feature_names": [
    "temperature_c",
    "vibration_mm_s"
  ],
  "matrix": [
    [
      2.0,
      1.0
    ],
    [
      4.0,
      3.0
    ]
  ]
}

Code example (Python)

# DataLens.ai example
# Factorise the named two- or three-sensor calibration matrix.
from scipy.linalg import lu
P,L,U = lu(A)
assert np.allclose(P @ L @ U, A)
print("Expected output verified")