adelie.adelie_core.matrix.MatrixConstraintSparse64C#
- class adelie.adelie_core.matrix.MatrixConstraintSparse64C#
Core matrix class for sparse constraint matrix.
Methods
__init__
(self, rows, cols, nnz, outer, ...)cols
(self)Returns the number of columns.
cov
(self, arg0, arg1)Computes the covariance matrix.
mul
(self, arg0, arg1)Computes a matrix-vector multiplication.
rmmul
(self, arg0, arg1, arg2)Computes a row vector-matrix multiplication.
rows
(self)Returns the number of rows.
rvmul
(self, arg0, arg1)Computes a row vector-vector multiplication.
rvtmul
(self, arg0, arg1, arg2)Computes a row vector-scalar multiplication increment.
sp_mul
(self, arg0, arg1, arg2)Computes a matrix-sparse vector multiplication.
tmul
(self, arg0, arg1)Computes a matrix transpose-vector multiplication.
Attributes
Number of dimensions.
Shape of the matrix.
- __init__(self: adelie.adelie_core.matrix.MatrixConstraintSparse64C, rows: int, cols: int, nnz: int, outer: numpy.ndarray[numpy.int32[1, n]], inner: numpy.ndarray[numpy.int32[1, n]], value: numpy.ndarray[numpy.float64[1, n]], n_threads: int) None #
- cols(self: adelie.adelie_core.matrix.MatrixConstraintBase64) int #
Returns the number of columns.
- Returns:
- colsint
Number of columns.
- cov(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], arg1: numpy.ndarray[numpy.float64[m, n], flags.writeable, flags.f_contiguous]) None #
Computes the covariance matrix.
Computes the covariance matrix
A @ Q @ A.T
.- Parameters:
- Q(d, d) ndarray
Matrix of weights.
- out(m, m) ndarray
Matrix to store in-place the result.
- mul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None #
Computes a matrix-vector multiplication.
Computes the matrix-vector multiplication
v.T @ A
.- Parameters:
- v(m,) ndarray
Vector to multiply with the matrix.
- out(d,) ndarray
Vector to store in-place the result.
- rmmul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: int, arg1: numpy.ndarray[numpy.float64[m, n], flags.f_contiguous], arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None #
Computes a row vector-matrix multiplication.
Computes the matrix-vector multiplication
A[j].T @ Q
.- Parameters:
- jint
Row index.
- Q(d, d) ndarray
Matrix to dot product with the
j
th row.- out(d,) ndarray
Vector to store in-place the result.
- rows(self: adelie.adelie_core.matrix.MatrixConstraintBase64) int #
Returns the number of rows.
- Returns:
- rowsint
Number of rows.
- rvmul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: int, arg1: numpy.ndarray[numpy.float64[1, n]]) float #
Computes a row vector-vector multiplication.
Computes the dot-product
A[j].T @ v
.- Parameters:
- jint
Row index.
- v(d,) ndarray
Vector to dot product with the
j
th row.
- Returns:
- dotfloat
Row vector-vector multiplication.
- rvtmul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: int, arg1: float, arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None #
Computes a row vector-scalar multiplication increment.
Computes the vector-scalar multiplication
A[j] * v
. The result is incremented into the output vector.- Parameters:
- jint
Row index.
- vfloat
Scalar to multiply with the
j
th row.- out(d,) ndarray
Vector to increment in-place the result.
- sp_mul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: numpy.ndarray[numpy.int64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n]], arg2: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None #
Computes a matrix-sparse vector multiplication.
Computes the matrix-sparse vector multiplication
v.T @ A
wherev
is represented by the sparse-formatindices
andvalues
.- Parameters:
- indices(nnz,) ndarray
Vector of indices with non-zero values of
v
. It does not have to be sorted in increasing order.- values(nnz,) ndarray
Vector of values corresponding to
indices
.- out(d,) ndarray
Vector to store in-place the result.
- tmul(self: adelie.adelie_core.matrix.MatrixConstraintBase64, arg0: numpy.ndarray[numpy.float64[1, n]], arg1: numpy.ndarray[numpy.float64[1, n], flags.writeable]) None #
Computes a matrix transpose-vector multiplication.
Computes the matrix transpose-vector multiplication
v.T @ A.T
.- Parameters:
- v(d,) ndarray
Vector to multiply with the matrix.
- out(m,) ndarray
Vector to store in-place the result.
- ndim#
Number of dimensions. It is always
2
.
- shape#
Shape of the matrix.