linsolve
Solve a linear system with optional structure hints.
Syntax
Section titled “Syntax”X = linsolve(A, B)X = linsolve(A, B, opts)Description
Section titled “Description”Solves A*X = B for X. Equivalent to MATLAB’s backslash A\B for the simple form, but accepts an opts struct with hints about A’s structure (LT lower-triangular, UT upper-triangular, SYM symmetric, POSDEF positive-definite, RECT rectangular least-squares, TRANSA apply transpose).
With hints, LAPACK uses the appropriate specialized solver — substantially faster than the generic LU pivoted solver when the structure is known.
Examples
Section titled “Examples”A = magic(3); b = [1; 2; 3];x = linsolve(A, b) % solves A*x = bnorm(A*x - b) % near-zero