adelie.adelie_core.matrix.MatrixNaiveInteractionDense64F#

class adelie.adelie_core.matrix.MatrixNaiveInteractionDense64F#

Core matrix class for naive interaction matrix.

Methods

__init__(self, mat, pairs, levels, 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.

mul(self, arg0, arg1, arg2)

Computes a matrix-vector multiplication.

rows(self)

Returns the number of rows.

sp_btmul(self, arg0, arg1)

Computes a matrix transpose-sparse matrix multiplication.

Attributes

group_sizes

List of group sizes corresponding to each element in groups.

groups

List of starting indices to each group where G is the number of groups.

ndim

Number of dimensions.

shape

Shape of the matrix.

__init__(self: adelie.adelie_core.matrix.MatrixNaiveInteractionDense64F, mat: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], pairs: numpy.ndarray[numpy.int64[m, n], flags.c_contiguous], levels: 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] for a column j.

Parameters:
jint

Column index.

v(n,) ndarray

Vector to dot product with the j th column with.

w(n,) ndarray

Vector of weights.

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

Returns the 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] for a column 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.

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 block matrix.

w(n,) ndarray

Vector of weights.

out(q,) ndarray

Vector to store in-place the result.

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

Returns the number of rows.

sp_btmul(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 @ 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.

group_sizes#

List of group sizes corresponding to each element in groups. group_sizes[i] is the group size of the i th group.

groups#

List of starting indices to each group where G is the number of groups. groups[i] is the starting index of the i th group. The groups are naturally defined by pairs. In the order of the rows of pairs, we group all columns of the current matrix corresponding to each row of pairs.

ndim#

Number of dimensions. It is always 2.

shape#

Shape of the matrix.