adelie.adelie_core.matrix.MatrixNaiveKroneckerEyeDense64C#

class adelie.adelie_core.matrix.MatrixNaiveKroneckerEyeDense64C#

Core matrix class for naive Kronecker product (dense) with identity matrix.

Methods

__init__(self, mat, K, n_threads)

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

Computes a column block matrix-vector multiplication.

bmul_safe(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.

cmul_safe(self, arg0, arg1, arg2)

Computes a column vector-vector multiplication.

cols(self)

Returns the number of columns.

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

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.MatrixNaiveKroneckerEyeDense64C, mat: numpy.ndarray[numpy.float64[m, n], flags.c_contiguous], K: int, 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].

Warning

This function is not thread-safe!

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.

bmul_safe(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.

Thread-safe version of bmul().

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.

Warning

This function is not thread-safe!

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].

Warning

This function is not thread-safe!

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.

cmul_safe(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.

Thread-safe version of cmul().

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]) None#

Computes a weighted covariance matrix.

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

This function is thread-safe.

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.

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.

Warning

This function is not thread-safe!

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.MatrixNaiveKroneckerEyeDense64C, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None#

Computes the implied column means.

It is undefined for this matrix class and is only exposed for API consistency.

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.MatrixNaiveKroneckerEyeDense64C, 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.

It is undefined for this matrix class and is only exposed for API consistency.

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.