scipy.linalg — Linear algebra routines

The scipy.linalg submodule provides a small selection of linear solvers that operate on numpy.ndarray objects.

Functions

scipy.linalg.cho_solve(c: ndarray, b: ndarray) ndarray

Solve the linear system A @ x = b given the Cholesky factorization of A. Unlike CPython’s scipy.linalg.cho_solve the function takes the Cholesky-factorised matrix directly rather than a (c, lower) tuple.

Parameters:
  • c – the Cholesky factor of A as a square two-dimensional numpy.ndarray.

  • b – a one-dimensional numpy.ndarray giving the right-hand side.

Returns:

the solution vector x as a float numpy.ndarray.

scipy.linalg.solve_triangular(a: ndarray, b: ndarray, lower: bool = False) ndarray

Solve the linear system a @ x = b for x assuming that a is a triangular matrix.

Parameters:
  • a – a square two-dimensional numpy.ndarray. Only the upper or lower triangle is read, depending on lower.

  • b – a one-dimensional numpy.ndarray giving the right-hand side.

  • lower – if True, take the data from the lower triangle of a; otherwise from the upper triangle. Default False.

Returns:

the solution vector x as a float numpy.ndarray.

a itself need not be triangular: values outside the selected triangle are simply treated as zero. In that case a @ x will not reproduce b.