chemreac.util.banded¶
this module contains functions to deal with banded matrices.
-
chemreac.util.banded.
get_banded
(A, n, N, n_jac_diags=1, order='C', padded=False)[source]¶ Turns a dense matrix into a banded one
Turns a dense matrix (n·N) × (n·N) into a banded matrix including the diagonal and n super-diagonals and n sub-diagonals.
- Parameters
- A: 2-dimensional square matrix
- n: int
sub-block dimension
- N: int
number of super-blocks
- n_jac_diags: int
number of diagonals (default: 1)
- order: {‘C’, ‘F’}, optional
C- or Fortran-contiguous
- padded: bool, optional
default: False, if True: A is padded with n rows along the top
- Raises
- ValueError on mismatch of A.shape and n*N
-
chemreac.util.banded.
get_jac_row_from_banded
(J, rows, n, n_jac_diags=1)[source]¶ Extracts rows from a banded matrix J
- Parameters
- J: 2-dimensional array
Source matrix with banded storage.
- rows: sequence
indices of rows to extract
- n: integer
row length
- n_jac_diags: integer
number of diagonals (default: 1)