Class CooSemiringMatrixOps
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.semiring_ops.CooSemiringMatrixOps
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V extends Semiring<V>>
SparseMatrixData<V> add
(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Adds two sparse matrices.static <V extends Semiring<V>>
SparseMatrixData<V> elemMult
(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Multiplies two sparse matrices element-wise.static <T extends Semiring<T>>
booleanisIdentity
(AbstractCooSemiringMatrix<?, ?, ?, T> src) Checks if a complex sparse matrix is the identity matrix.
-
Method Details
-
add
public static <V extends Semiring<V>> SparseMatrixData<V> add(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Adds two sparse matrices. This method assumes that the indices of the two matrices are sorted lexicographically.- Parameters:
shape1
- Shape of the first matrix.src1Entries
- Non-zero data of the first matrix.src1RowIndices
- Non-zero row indices of the first matrix.src1ColIndices
- Non-zero column indices of the first matrix.shape2
- Shape of the second matrix.src2Entries
- Non-zero data of the second matrix.src2RowIndices
- Non-zero row indices of the second matrix.src2ColIndices
- Non-zero column indices of the second matrix.- Returns:
- The sum of the two matrices.
- Throws:
IllegalArgumentException
- If the two matrices do not have the same shape.
-
elemMult
public static <V extends Semiring<V>> SparseMatrixData<V> elemMult(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Multiplies two sparse matrices element-wise. This method assumes that the indices of the two matrices are sorted lexicographically.- Parameters:
shape1
- Shape of the first matrix.src1Entries
- Non-zero data of the first matrix.src1RowIndices
- Non-zero row indices of the first matrix.src1ColIndices
- Non-zero column indices of the first matrix.shape2
- Shape of the second matrix.src2Entries
- Non-zero data of the second matrix.src2RowIndices
- Non-zero row indices of the second matrix.src2ColIndices
- Non-zero column indices of the second matrix.- Returns:
- The element-wise product of the two matrices.
- Throws:
IllegalArgumentException
- If the two matrices do not have the same shape.
-
isIdentity
Checks if a complex sparse matrix is the identity matrix.- Parameters:
src
- Matrix to check if it is the identity matrix.- Returns:
true
if thesrc
matrix is the identity matrix;false
otherwise.
-