Class MatrixFeatures_ZDRM
Functions for computing the features of complex matrices
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks to see if any element in the matrix is NaN.static boolean
Checks to see if any element in the matrix is NaN of Infinite.static boolean
Checks to see if each element in the two matrices are equal: aij == bijstatic boolean
Checks to see if each element in the two matrices are within tolerance of each other: tol ≥ |aij - bij|.static boolean
isHermitian
(ZMatrixRMaj Q, double tol) Hermitian matrix is a square matrix with complex entries that are equal to its own conjugate transpose.static boolean
isIdentical
(ZMatrixD1 a, ZMatrixD1 b, double tol) Checks to see if each corresponding element in the two matrices are within tolerance of each other or have the some symbolic meaning.static boolean
isIdentity
(ZMatrix mat, double tol) Checks to see if the provided matrix is within tolerance to an identity matrix.static boolean
isLowerTriangle
(ZMatrixRMaj A, int hessenberg, double tol) Checks to see if a matrix is lower triangular or Hessenberg.static boolean
isNegative
(ZMatrixD1 a, ZMatrixD1 b, double tol) Checks to see if the two matrices are the negative of each other:
aij = -bijstatic boolean
Checks to see if the matrix is positive definite.static boolean
isUnitary
(ZMatrixRMaj Q, double tol) Unitary matrices have the following properties:
Q*QH = Istatic boolean
isUpperTriangle
(ZMatrixRMaj A, int hessenberg, double tol) Checks to see if a matrix is upper triangular or Hessenberg.static boolean
Checks to see if the matrix is a vector or not.static boolean
Checks to see all the elements in the matrix are zeros
-
Method Details
-
isVector
Checks to see if the matrix is a vector or not.- Parameters:
mat
- A matrix. Not modified.- Returns:
- True if it is a vector and false if it is not.
-
isNegative
Checks to see if the two matrices are the negative of each other:
aij = -bij- Parameters:
a
- First matrix. Not modified.b
- Second matrix. Not modified.tol
- Numerical tolerance.- Returns:
- True if they are the negative of each other within tolerance.
-
hasNaN
Checks to see if any element in the matrix is NaN.- Parameters:
m
- A matrix. Not modified.- Returns:
- True if any element in the matrix is NaN.
-
hasUncountable
Checks to see if any element in the matrix is NaN of Infinite.- Parameters:
m
- A matrix. Not modified.- Returns:
- True if any element in the matrix is NaN of Infinite.
-
isEquals
Checks to see if each element in the two matrices are equal: aij == bij
NOTE: If any of the elements are NaN then false is returned. If two corresponding elements are both positive or negative infinity then they are equal.
- Parameters:
a
- A matrix. Not modified.b
- A matrix. Not modified.- Returns:
- true if identical and false otherwise.
-
isEquals
Checks to see if each element in the two matrices are within tolerance of each other: tol ≥ |aij - bij|.
NOTE: If any of the elements are not countable then false is returned.
NOTE: If a tolerance of zero is passed in this is equivalent to callingisEquals(ZMatrixD1, ZMatrixD1)
- Parameters:
a
- A matrix. Not modified.b
- A matrix. Not modified.tol
- How close to being identical each element needs to be.- Returns:
- true if equals and false otherwise.
-
isIdentical
Checks to see if each corresponding element in the two matrices are within tolerance of each other or have the some symbolic meaning. This can handle NaN and Infinite numbers.
If both elements are countable then the following equality test is used:
|aij - bij| ≤ tol.
Otherwise both numbers must both be Double.NaN, Double.POSITIVE_INFINITY, or Double.NEGATIVE_INFINITY to be identical.- Parameters:
a
- A matrix. Not modified.b
- A matrix. Not modified.tol
- Tolerance for equality.- Returns:
- true if identical and false otherwise.
-
isIdentity
Checks to see if the provided matrix is within tolerance to an identity matrix.- Parameters:
mat
- Matrix being examined. Not modified.tol
- Tolerance.- Returns:
- True if it is within tolerance to an identify matrix.
-
isHermitian
Hermitian matrix is a square matrix with complex entries that are equal to its own conjugate transpose.
a[i,j] = conj(a[j,i])
- Parameters:
Q
- The matrix being tested. Not modified.tol
- Tolerance.- Returns:
- True if it passes the test.
-
isUnitary
Unitary matrices have the following properties:
Q*QH = IThis is the complex equivalent of orthogonal matrix.
- Parameters:
Q
- The matrix being tested. Not modified.tol
- Tolerance.- Returns:
- True if it passes the test.
-
isPositiveDefinite
Checks to see if the matrix is positive definite.
xT A x > 0
for all x where x is a non-zero vector and A is a hermitian matrix.- Parameters:
A
- square hermitian matrix. Not modified.- Returns:
- True if it is positive definite and false if it is not.
-
isUpperTriangle
Checks to see if a matrix is upper triangular or Hessenberg. A Hessenberg matrix of degree N has the following property:
aij ≤ 0 for all i < j+N
A triangular matrix is a Hessenberg matrix of degree 0.- Parameters:
A
- Matrix being tested. Not modified.hessenberg
- The degree of being hessenberg.tol
- How close to zero the lower left elements need to be.- Returns:
- If it is an upper triangular/hessenberg matrix or not.
-
isLowerTriangle
Checks to see if a matrix is lower triangular or Hessenberg. A Hessenberg matrix of degree N has the following property:
aij ≤ 0 for all i < j+N
A triangular matrix is a Hessenberg matrix of degree 0.- Parameters:
A
- Matrix being tested. Not modified.hessenberg
- The degree of being hessenberg.tol
- How close to zero the lower left elements need to be.- Returns:
- If it is an upper triangular/hessenberg matrix or not.
-
isZeros
Checks to see all the elements in the matrix are zeros- Parameters:
m
- A matrix. Not modified.- Returns:
- True if all elements are zeros or false if not
-