runlmc.linalg.matrix module

class runlmc.linalg.matrix.Matrix(n, m)[source]

Bases: object

An abstract class defining the interface for the necessary sparse matrix operations.

All matrices are assumed real.

Parameters:
  • n – number of rows in this matrix
  • m – number of columns in this matrix
Raises:

ValueError – if n < 1 or m < 1

as_linear_operator()[source]
Returns:this matrix as a scipy.sparse.linalg.LinearOperator
as_numpy()[source]
Returns:numpy matrix equivalent, as a 2D numpy.ndarray
is_square()[source]
matmat(X)[source]

Multiply a matrix \(X\) by this matrix, \(K\), yielding \(KX\). By default, this just repeatedly calls matvec().

Parameters:X – a (possibly rectangular) dense matrix.
Returns:the matrix-matrix product
matvec(x)[source]

Multiply a vector \(\textbf{x}\) by this matrix, \(K\), yielding \(K\textbf{x}\).

Parameters:x – a one-dimensional numpy array of the same size as this matrix
Returns:the matrix-vector product
static wrap(shape, mvm)[source]