Class CsrRingProperties
java.lang.Object
org.flag4j.linalg.ops.sparse.csr.ring_ops.CsrRingProperties
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
booleanallClose
(AbstractCsrRingMatrix<?, ?, ?, T> src1, AbstractCsrRingMatrix<?, ?, ?, T> src2, double relTol, double absTol) Checks if all data of this tensor are close to the data of the argumenttensor
.static <T extends Ring<T>>
booleanisCloseToIdentity
(AbstractCsrRingMatrix<?, ?, ?, T> src) Checks if thesrc
matrix is close to the identity matrix.static <T extends Ring<T>>
booleanisHermitian
(Shape shape, T[] values, int[] rowPointers, int[] colIndices) Checks if a sparse CSR matrix is Hermitian.
-
Method Details
-
allClose
public static <T extends Ring<T>> boolean allClose(AbstractCsrRingMatrix<?, ?, ?, T> src1, AbstractCsrRingMatrix<?, ?, ?, T> src2, double relTol, double absTol) Checks if all data of this tensor are close to the data of the argumenttensor
.- Parameters:
src1
- First matrix in the comparison.src2
- Second matrix in the comparison.relTol
- Relative tolerance.absTol
- Absolute tolerance.- Returns:
- True if the
src1
matrix is the same shape as thesrc2
matrix and all data are 'close', i.e. elementsa
andb
at the same positions in the two matrices respectively satisfy|a-b| <= (absTol + relTol*|b|)
. Otherwise, returns false.
-
isCloseToIdentity
Checks if thesrc
matrix is close to the identity matrix.- Parameters:
src
- The matrix to check.- Returns:
- True if the
src
matrix is close to identity matrix. False otherwise.
-
isHermitian
public static <T extends Ring<T>> boolean isHermitian(Shape shape, T[] values, int[] rowPointers, int[] colIndices) Checks if a sparse CSR matrix is Hermitian.- Parameters:
shape
- Shape of the CSR matrix.values
- Non-zero values of a CSR matrix.rowPointers
- Non-zero row pointers of the CSR matrix.colIndices
- Non-zero column indices of the CSR matrix.- Returns:
true
if the CSR matrix is Hermitian (i.e. equal to its conjugate transpose);false
otherwise.
-