dedalus.tools.sparse
Tools for working with sparse matrices.
Module Contents
- scipy_sparse_eigs(A, B, N, target, matsolver, **kw)
Perform targeted eigenmode search using the scipy/ARPACK sparse solver for the reformulated generalized eigenvalue problem
A.x = λ B.x ==> (A - σB)^I B.x = (1/(λ-σ)) x
for eigenvalues λ near the target σ.
- Parameters
A, B (scipy sparse matrices) – Sparse matrices for generalized eigenvalue problem
N (int) – Number of eigenmodes to return
target (complex) – Target σ for eigenvalue search
matsolver (matrix solver class) – Class implementing solve method for solving sparse systems.
Other keyword options passed to scipy.sparse.linalg.eigs.
- same_dense_block_diag(blocks, format=None, dtype=None)
Build a block diagonal sparse matrix from identically shaped dense blocks.
- Parameters
blocks (sequence of 2D ndarrays) – Input matrix blocks.
format (str, optional) – The sparse format of the result (e.g. “csr”). If not given, the matrix is returned in “coo” format.
dtype (dtype specifier, optional) – The data-type of the output matrix. If not given, the dtype is determined from that of blocks.
- Returns
res
- Return type
sparse matrix
- fast_csr_matvec(A_csr, x_vec, out_vec)
Fast CSR matvec skipping type and shape checks. The result is added to the specificed output array, so the output should be manually zeroed prior to calling this routine, if necessary.