Class CooRingMatrixOps
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.ring_ops.CooRingMatrixOps
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
booleanisCloseToIdentity(AbstractCooRingMatrix<?, ?, ?, T> src) Checks if a real sparse matrix is close to the identity matrix.static <T extends Ring<T>>
booleanisHermitian(Shape shape, T[] data, int[] rowIndices, int[] colIndices) Checks if a sparse COORingmatrix is Hermitian.static <V extends Ring<V>>
SparseMatrixData<V> sub(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Computes the element-wise difference of two sparse matrices.
-
Method Details
-
sub
public static <V extends Ring<V>> SparseMatrixData<V> sub(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices) Computes the element-wise difference of 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 element-wise difference of the two matrices.
- Throws:
IllegalArgumentException- If the two matrices do not have the same shape.
-
isCloseToIdentity
Checks if a real sparse matrix is close to the identity matrix.- Parameters:
src- Matrix to check if it is the identity matrix.- Returns:
trueif thesrcmatrix is the identity matrix;falseotherwise.
-
isHermitian
public static <T extends Ring<T>> boolean isHermitian(Shape shape, T[] data, int[] rowIndices, int[] colIndices) Checks if a sparse COORingmatrix is Hermitian.- Type Parameters:
T- The ring to which the data values of the COO matrix belong.- Parameters:
shape- The shape of the COO matrix.data- Non-zero entries of the COO matrix.rowIndices- Non-zero row indices of the COO matrix.colIndices- Non-zero column indices of the COO matrix.- Returns:
trueif the specified COO matrix is Hermitian (i.e. equal to its conjugate transpose);falseotherwise.
-