Numerical Methods

pbeis.bicgstab(A, b, start_point=None, callback=None, tol=0.001)

Solves the linear equation Ax = b using the BiCGSTAB method.

Parameters

Ascipy.sparse.csr_matrix

A square matrix represented as a SciPy sparse CSR matrix.

bnumpy.ndarray

Right-hand side vector in the equation Ax = b, expected to be an n x 1 dimensional array.

start_pointnumpy.ndarray, optional

The starting guess for the iteration. Defaults to a zero vector if not provided.

callbackcallable, optional

A function callback(xk) that is called after each iteration, where xk is the current solution vector. If no function is provided, no action is taken at each iteration.

tolfloat, optional

The tolerance level for convergence. The iteration will stop when the residual is below this tolerance. Default is 1e-3.

Returns

xknumpy.ndarray

The solution vector to the equation Ax = b, as an n x 1 dimensional array.

pbeis.prebicgstab(A, b, LU, start_point=None, callback=None, tol=0.001)

Solves the linear equation Ax = b using the preconditioned BiCGSTAB method. The preconditioner is specified as LU, which could be the form of an LU decomposition.

Parameters

Ascipy.sparse.csr_matrix

A square matrix.

bnumpy.ndarray

Right-hand side vector in the equation Ax = b, expected to be an n x 1 dimensional array.

LUscipy.sparse.csr_matrix

The LU decomposition of A, typically a scipy.sparse.linalg.SuperLU object.

start_pointnumpy.ndarray, optional

The starting guess for the iteration. Defaults to a zero vector if not provided.

callbackcallable, optional

A function callback(xk) that is called after each iteration, where xk is the current solution vector. The default behavior is to perform no action on callback.

tolfloat, optional

The tolerance level for convergence. The iteration will stop when the residual is below this tolerance. Default is 1e-3.

Returns

xknumpy.ndarray

The solution vector to the equation Ax = b, as an n x 1 dimensional array.