Package org.flag4j.operations.dense.real
Class RealDenseProperties
java.lang.Object
org.flag4j.operations.dense.real.RealDenseProperties
This class contains low-level implementations for operations which check if a tensor satisfies some property.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isAntiSymmetric
(double[] src, Shape shape) Checks if a real dense matrix is anti-symmetric.static boolean
isCloseToIdentity
(Matrix src) Checks if a matrix is the identity matrix approximately.boolean
isIdentity
(Matrix src) Checks if a matrix is the identity matrix exactly.static boolean
isOnes
(double[] src) Checks if this tensor only contains ones.static boolean
isSymmetric
(double[] src, Shape shape) Checks if a real dense matrix is symmetric.
-
Constructor Details
-
RealDenseProperties
private RealDenseProperties()
-
-
Method Details
-
isOnes
public static boolean isOnes(double[] src) Checks if this tensor only contains ones.- Parameters:
src
- Elements of the tensor.- Returns:
- True if this tensor only contains ones. Otherwise, returns false.
-
isSymmetric
Checks if a real dense matrix is symmetric. That is, if the matrix is equal to its transpose.- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.- Returns:
- True if this matrix is symmetric
-
isAntiSymmetric
Checks if a real dense matrix is anti-symmetric. That is, if the matrix is equal to its negative transpose.- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.- Returns:
- True if this matrix is anti-symmetric
-
isIdentity
Checks if a matrix is the identity matrix exactly.- Parameters:
src
- Matrix of interest to check if it is the identity matrix.- Returns:
- True if the
src
matrix is exactly the identity matrix.
-
isCloseToIdentity
Checks if a matrix is the identity matrix approximately. Specifically, if the diagonal entries are no farther than 1.001E-5 in absolute value from 1.0 and the non-diagonal entries are no larger than 1e-08 in absolute value. These tolerances are derived from theTensorBase.allClose(Object)
method.- Parameters:
src
- Matrix of interest to check if it is the identity matrix.- Returns:
- True if the
src
matrix is exactly the identity matrix.
-