solve

UMFFactor.solve(b, A=None, *, trans='N')[source]

Solve a linear system using the LU factorization.

This method solves one of the following linear systems:

  • \(A x = b\) (if trans='N')

  • \(A^{\top} x = b\) (if trans='T' and \(A\) is real)

  • \(A^{H} x = b\) (if trans='H' and \(A\) is complex)

The matrix \(A\) must have the same shape and nonzero pattern as the one used to create this UMFFactor object, but need not have the same values. No check is performed to ensure that the input matrix is compatible with the existing factorization.

Parameters:
  • b ((N,) numpy.ndarray or sparse array) – The right-hand side vector.

  • A ((N, N) numpy.ndarray or sparse array, optional) – The input matrix. Must have the same shape and nonzero pattern as the matrix used to create this UMFFactor object.

  • trans (str, optional) – The type of system to solve. Possible values are:

    • N: solve \(A x = b\) (default)

    • T: solve \(A^{\top} x = b\)

    • H: solve \(A^{H} x = b\)

    Note

    If \(A\) is real, then T and H are equivalent.

Returns:

x ((N,) or (N, K) numpy.ndarray or sparse array) – The solution vector or matrix. If b is a 1D array, then x is returned as a 1D array. If b is a 2D array with K columns, then x is returned as a 2D array with K columns. If b is a sparse array, then x is also returned as a sparse array.

Raises:

UMFPACKSingularMatrixWarning – If the matrix is detected to be singular to working precision. In that case, the solution will have infinite or NaN values, but other entries may still be valid.