Class DenseRingTensorOps
java.lang.Object
org.flag4j.linalg.ops.dense.ring_ops.DenseRingTensorOps
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
booleanisCloseToIdentity(Shape shape, T[] src) Checks if a matrix is the identity matrix approximately.static <T extends Ring<T>>
booleanisHermitian(Shape shape, T[] src) Checks if a complex dense matrix is Hermitian.static <T extends Ring<T>>
voidComputes the element-wise difference between two dense tensors.
-
Method Details
-
sub
public static <T extends Ring<T>> void sub(Shape shape1, T[] src1, Shape shape2, T[] src2, T[] dest) Computes the element-wise difference between two dense tensors.- Parameters:
shape1- Shape of the first tensor in the element-wise difference.src1- Entries of the first tensor in the element-wise difference.shape2- Shape of the second tensor in the element-wise difference.src2- Entries of the second tensor in the element-wise difference.dest- Array to store the resulting element-wise difference. May be the same array as eithersrc1orsrc2.- Throws:
TensorShapeException- If!shape1.equals(shape2).ArrayIndexOutOfBoundsException- Ifsrc2.length < src2.length || dest.length < src1.length
-
isHermitian
Checks if a complex dense matrix is Hermitian. That is, if the matrix is equal to its conjugate transpose.- Parameters:
shape- Shape of the matrix.src- Entries of the matrix.- Returns:
trueif this matrix is Hermitian;falseotherwise.
-
isCloseToIdentity
Checks if a matrix is the identity matrix approximately.
Specifically, if the diagonal data are no farther than
1.001E-5in absolute value from1.0and the non-diagonal data are no larger than1e-08in absolute value.These thresholds correspond to the thresholds from the
RingProperties.allClose(Ring[], Ring[])method.- Parameters:
src- Matrix of interest to check if it is the identity matrix.- Returns:
- True if the
srcmatrix is close the identity matrix or if the matrix has zero data.
-