adelie.adelie_core.matrix.MatrixNaiveRSubset64#

class adelie.adelie_core.matrix.MatrixNaiveRSubset64#

Core matrix class for naive row-subsetted matrix.

Methods

__init__(self, mat, subset, n_threads)

bmul(self, arg0, arg1, arg2, arg3, arg4)

Computes a column block matrix-vector multiplication.

btmul(self, arg0, arg1, arg2, arg3)

Computes a column block matrix transpose-vector multiplication increment.

cmul(self, arg0, arg1, arg2)

Computes a column vector-vector multiplication.

cols(self)

Returns the number of columns.

cov(self, arg0, arg1, arg2, arg3, arg4)

Computes a weighted covariance matrix.

ctmul(self, arg0, arg1, arg2)

Computes a column vector-scalar multiplication increment.

mean(self, arg0, arg1)

Computes the implied column means.

mul(self, arg0, arg1, arg2)

Computes a matrix-vector multiplication.

rows(self)

Returns the number of rows.

sp_tmul(self, arg0, arg1)

Computes a matrix transpose-sparse matrix multiplication.

sq_mul(self, arg0, arg1)

Computes a squared matrix-vector multiplication.

var(self, arg0, arg1, arg2)

Computes the implied column variances.

Attributes

ndim

Number of dimensions.

shape

Shape of the matrix.

__init__(self: adelie.adelie_core.matrix.MatrixNaiveRSubset64, mat: adelie.adelie_core.matrix.MatrixNaiveBase64, subset: numpy.ndarray[numpy.int64[1, n]], n_threads: int) None#
bmul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: int, arg1: int, arg2: numpy.ndarray[numpy.float64[1, n]], arg3: numpy.ndarray[numpy.float64[1, n]], arg4: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes a column block matrix-vector multiplication.

Computes the matrix-vector multiplication (v * w).T @ X[:, j:j+q].

Parameters:
jint

Column index.

qint

Number of columns.

v(n,) ndarray

Vector to multiply with the block matrix.

w(n,) ndarray

Vector of weights.

out(q,) ndarray

Vector to store in-place the result.

btmul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: int, arg1: int, arg2: numpy.ndarray[numpy.float64[1, n]], arg3: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes a column block matrix transpose-vector multiplication increment.

Computes the matrix-vector multiplication v.T @ X[:, j:j+q].T. The result is incremented into the output vector.

Parameters:
jint

Column index.

qint

Number of columns.

v(q,) ndarray

Vector to multiply with the block matrix.

out(n,) ndarray

Vector to increment in-place the result.

cmul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: int, arg1: numpy.ndarray[numpy.float64[1, n]], arg2: numpy.ndarray[numpy.float64[1, n]]) float#

Computes a column vector-vector multiplication.

Computes the dot-product (v * w).T @ X[:,j].

Parameters:
jint

Column index.

v(n,) ndarray

Vector to dot product with the j th column.

w(n,) ndarray

Vector of weights.

Returns:
dotfloat

Column vector-vector multiplication.

cols(self: adelie.adelie_core.matrix.MatrixNaiveBase64) int#

Returns the number of columns.

Returns:
colsint

Number of columns.

cov(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: int, arg1: int, arg2: numpy.ndarray[numpy.float64[1, n]], arg3: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous], arg4: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous]) None#

Computes a weighted covariance matrix.

Computes the weighted covariance matrix X[:, j:j+q].T @ W @ X[:, j:j+q].

Note

Although the name is “covariance”, we do not center the columns of X!

Parameters:
jint

Column index.

qint

Number of columns.

sqrt_weights(n,) ndarray

Square-root of the weights.

out(q, q) ndarray

Matrix to store in-place the result.

buffer(n, q) ndarray

Extra buffer space if needed.

ctmul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: int, arg1: float, arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes a column vector-scalar multiplication increment.

Computes the vector-scalar multiplication v * X[:,j]. The result is incremented into the output vector.

Parameters:
jint

Column index.

vfloat

Scalar to multiply with the j th column.

out(n,) ndarray

Vector to increment in-place the result.

mean(self: adelie.adelie_core.matrix.MatrixNaiveRSubset64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes the implied column means.

The implied column means are the implied column means of the underlying matrix where the weights are zero outside of the subset.

Parameters:
weights(n,) ndarray

Vector of weights.

out(p,) ndarray

Vector to store in-place the result.

mul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n]], arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes a matrix-vector multiplication.

Computes the matrix-vector multiplication (v * w).T @ X.

Parameters:
v(n,) ndarray

Vector to multiply with the matrix.

w(n,) ndarray

Vector of weights.

out(p,) ndarray

Vector to store in-place the result.

rows(self: adelie.adelie_core.matrix.MatrixNaiveBase64) int#

Returns the number of rows.

Returns:
rowsint

Number of rows.

sp_tmul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: scipy.sparse.csr_matrix[numpy.float64], arg1: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.c_contiguous]) None#

Computes a matrix transpose-sparse matrix multiplication.

Computes the matrix transpose-sparse matrix multiplication v.T @ X.T.

Parameters:
v(L, p) csr_matrix

Sparse matrix to multiply with the matrix.

out(L, n) ndarray

Matrix to store in-place the result.

sq_mul(self: adelie.adelie_core.matrix.MatrixNaiveBase64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes a squared matrix-vector multiplication.

Computes the squared matrix-vector multiplication w.T @ X ** 2.

Parameters:
weights(n,) ndarray

Vector of weights.

out(p,) ndarray

Vector to store in-place the result.

var(self: adelie.adelie_core.matrix.MatrixNaiveRSubset64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n]], arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes the implied column variances.

The implied column variances are the implied column variances of the underlying matrix where the weights are zero outside of the subset.

Parameters:
centers(p,) ndarray

Vector of centers.

weights(n,) ndarray

Vector of weights.

out(p,) ndarray

Vector to store in-place the result.

ndim#

Number of dimensions. It is always 2.

shape#

Shape of the matrix.