runlmc.linalg.numpy_matrix module

class runlmc.linalg.numpy_matrix.NumpyMatrix(nparr)[source]

Bases: runlmc.linalg.matrix.Matrix

Adapter to Matrix with numpy arrays.

Creates a NumpyMatrix matrix.

Parameters:nparr – 2-dimensional numpy array
Raises:ValueError – if nparr isn’t 2D
as_numpy()[source]
Returns:numpy matrix equivalent, as a 2D numpy.ndarray
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