finesse.cymath.sparsemath.CSRMatrix

Overview

class finesse.cymath.sparsemath.CSRMatrix(ndarray A)

Bases: object

A complex value Compressed Sparse Row (CSR) matrix. This is a useful format for storing a sparse matrix for fast matrix vector products.

This class wraps the csr_matrix structure which is pure C and so can be passed to functions that do not need the GIL.

Parameters:
Anp.ndarray[complex, ndim=2]

A dense matrix to convert into a sparse format

Properties

CSRMatrix.col_index

Column index for each non-zero element

CSRMatrix.cols

Number of columns in matrix

CSRMatrix.nnz

Number of non-zero elements

CSRMatrix.row_ptr

Index in values and col_index where each row starts

CSRMatrix.rows

Number of rows in matrix

CSRMatrix.values

Sparse matrix non-zero values

Methods

CSRMatrix.__init__(*args, **kwargs)

CSRMatrix.multiply(self, ndarray x)

Compute y = M @ x

CSRMatrix.zcsrgecmv(self, ndarray x, ndarray y)

Complex (z) valued CSR (csr) general (ge) hermitiain conjugate vector (c) matrix (m) vector (v) product.

CSRMatrix.zcsrgevmv(self, ndarray x, ndarray y)

Complex (z) valued CSR (csr) general (ge) transpose vector (v) matrix (m) vector (v) product.