fn
solve_ex
→Tensorsolve_ex(A: Tensor, B: Tensor, left: bool = True, check_errors: bool = False)Solve with an explicit success flag.
Variant of solve that returns an info code instead of
raising on a singular coefficient matrix.
info == 0— success; is the unique solution.info != 0— was singular; is zero-filled.
Parameters
ATensorCoefficient matrix of shape
(*, n, n).BTensorRight-hand side of shape
(*, n, k) (or (*, n)).left(bool, keyword - only)= TrueCurrently must be
True. False (X A = B) is not yet
implemented and raises NotImplementedError.check_errors(bool, keyword - only)= FalseIf
True, re-raise the underlying engine error instead of
emitting a non-zero info.Returns
TensorSolution (or zero placeholder) shaped like B.
Notes
Implementation calls solve under the hood and converts the
raised exception into the info flag. This is the recommended
form when calling from inside a batched / jit-compiled / vmapped
routine where raising would break control flow; manually inspect
info afterwards and decide whether to recover.
Examples
>>> import lucid
>>> from lucid.linalg import solve_ex
>>> A = lucid.tensor([[3.0, 1.0], [1.0, 2.0]])
>>> b = lucid.tensor([9.0, 8.0])
>>> X, info = solve_ex(A, b)
>>> int(info)
0