mojolearn.lu_solve#
- mojolearn.lu_solve(lu_and_piv, b, *, trans=0, numeric_mode=None)[source]#
Solve a linear system from an LU factorization.
Follows
scipy.linalg.lu_solve: solvesA x = b(trans=0) orA.T x = b(trans=1or2; the same for a real matrix) with the pair returned by lu_factor(). A zero pivot gives 0 in that component of x, never infinity or NaN.- Parameters:
lu_and_piv (tuple (lu, piv)) – The output of lu_factor().
b (array-like of shape (n,) or (n, nrhs)) – Right-hand side.
trans ({0, 1, 2}, default 0) – Which system to solve.
numeric_mode ({“identical”, “fast”} or None, default None) – Numeric mode for this call. None uses the package default (
"identical"unless changed)."identical"gives the same bits on NVIDIA and AMD GPUs;"fast"applies on Apple GPUs.
- Returns:
x (ndarray of shape (n,) or (n, nrhs), float32) – Same shape as
b.- Raises:
ValueError – If
transis not 0, 1 or 2,pivholds an index outside [0, n),bhas the wrong number of rows, orbis not finite.