dctkit.math namespace
Subpackages
Submodules
dctkit.math.permutation module
- dctkit.math.permutation.compute_permutation_vectors(n: int) Array[source]
Computes all permutation vectors of length n.
- Parameters:
n – The number of elements to permute.
- Returns:
a JAX array of shape (n!, n) containing all permutations of the integers from 0 to n-1.
- dctkit.math.permutation.permutation_sign(p: Array) Array[source]
Vectorized version of permutation_sign. Takes similar arguments as permutation_sign but with additional array axes over which permutation_sign is mapped.
Original documentation:
Computes the sign of a permutation.
The sign is +1 for even permutations and -1 for odd permutations. It is computed as the determinant of the corresponding permutation matrix.
- Parameters:
p – A 1D array representing a permutation of integers.
- Returns:
the sign of the permutations.
dctkit.math.shifted_list module
dctkit.math.spmm module
- dctkit.math.spmm.spmm(A: Tuple[Array | ndarray[tuple[Any, ...], dtype[_ScalarT]], Array | ndarray[tuple[Any, ...], dtype[_ScalarT]], Array | ndarray[tuple[Any, ...], dtype[_ScalarT]]], v: Array | ndarray[tuple[Any, ...], dtype[_ScalarT]], transpose=False, shape=None) Array[source]
Performs the matrix-matrix product between a sparse matrix in COO format and a dense matrix or column vector.
- Parameters:
A – tuple (rows,cols,values) representing the sparse matrix in COO format.
v – matrix or column vector.
transpose – whether to transpose A before multiplication.
shape – the number of rows of the matrix A.
- Returns:
the result of the matrix-matrix product.