imsl.linalg.LU.solve¶
- LU.solve(b, transpose=False)¶
Solve a system of linear equations using right-hand side b.
See also
- lu_solve
- equivalent function containing full documentation.
Notes
This method caches the LU factorization the first time it is calculated, and re-uses it on subsequent calls. This is especially useful if linear systems with the same coefficient matrix but different right-hand sides have to be solved.
Examples
>>> import imsl.linalg as la >>> a = [[1.0, 3.0, 3.0], [1.0, 3.0, 4.0], [1.0, 4.0, 3.0]] >>> b = [1.0, 4.0, -1.0] >>> lu = la.LU(a) >>> x = lu.solve(b) >>> print(x) [-2. -2. 3.]