Class RealCsrEquals
java.lang.Object
org.flag4j.operations.sparse.csr.real.RealCsrEquals
This class contains methods to check equality or approximate equality between two sparse CSR matrices.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks if all entries of this tensor are close to the entries of the argumenttensor
.private static void
removeCloseToZero
(CsrMatrix src, List<Double> entries, int[] rowPointers, List<Integer> colIndices, double aTol) Removes entries insrc
which are withinatol
in absolute value from zero.
-
Constructor Details
-
RealCsrEquals
private RealCsrEquals()
-
-
Method Details
-
allClose
Checks if all entries of this tensor are close to the entries 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 entries are 'close', i.e. elementsa
andb
at the same positions in the two matrices respectively satisfy|a-b| <= (absTol + relTol*|b|)
. Otherwise, returns false.
-
removeCloseToZero
private static void removeCloseToZero(CsrMatrix src, List<Double> entries, int[] rowPointers, List<Integer> colIndices, double aTol) Removes entries insrc
which are withinatol
in absolute value from zero.- Parameters:
src
- Source CSR matrix.entries
- List to store value insrc
which are not withinatol
in absolute value from zero.rowPointers
- Row pointers for entries.colIndices
- Column indices of entries.aTol
- Absolute tolerance for value to be considered close to zero.
-