public class MatrixFeatures_DDRM
extends java.lang.Object
Used to compute features that describe the structure of a matrix.
Unless explicitly stated otherwise it is assumed that the elements of input matrices contain only real numbers. If an element is NaN or infinite then the behavior is undefined. See IEEE 754 for more information on this issue.
Constructor and Description |
---|
MatrixFeatures_DDRM() |
Modifier and Type | Method and Description |
---|---|
static int |
countNonZero(org.ejml.data.DMatrixRMaj A)
Counts the number of elements in A which are not zero.
|
static boolean |
hasNaN(org.ejml.data.DMatrixD1 m)
Checks to see if any element in the matrix is NaN.
|
static boolean |
hasUncountable(org.ejml.data.DMatrixD1 m)
Checks to see if any element in the matrix is NaN of Infinite.
|
static boolean |
isConstantVal(org.ejml.data.DMatrixRMaj mat,
double val,
double tol)
Checks to see if every value in the matrix is the specified value.
|
static boolean |
isDiagonalPositive(org.ejml.data.DMatrixRMaj a)
Checks to see if all the diagonal elements in the matrix are positive.
|
static boolean |
isEquals(org.ejml.data.BMatrixRMaj a,
org.ejml.data.BMatrixRMaj b)
Checks to see if each element in the two matrices are equal:
aij == bij
|
static boolean |
isEquals(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b)
Checks to see if each element in the two matrices are equal:
aij == bij
|
static boolean |
isEquals(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
double tol)
Checks to see if each element in the two matrices are within tolerance of
each other: tol ≥ |aij - bij|.
|
static boolean |
isEqualsTriangle(org.ejml.data.DMatrix a,
org.ejml.data.DMatrix b,
boolean upper,
double tol)
Checks to see if each element in the upper or lower triangular portion of the two matrices are within tolerance of
each other: tol ≥ |aij - bij|.
|
static boolean |
isFullRank(org.ejml.data.DMatrixRMaj a) |
static boolean |
isIdentical(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 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(org.ejml.data.DMatrixRMaj mat,
double tol)
Checks to see if the provided matrix is within tolerance to an identity matrix.
|
static boolean |
isInverse(org.ejml.data.DMatrixRMaj a,
org.ejml.data.DMatrixRMaj b,
double tol)
Checks to see if the two matrices are inverses of each other.
|
static boolean |
isLowerTriangle(org.ejml.data.DMatrixRMaj A,
int hessenberg,
double tol)
Checks to see if a matrix is lower triangular or Hessenberg.
|
static boolean |
isNegative(org.ejml.data.DMatrixD1 a,
org.ejml.data.DMatrixD1 b,
double tol)
Checks to see if the two matrices are the negative of each other:
aij = -bij |
static boolean |
isOrthogonal(org.ejml.data.DMatrixRMaj Q,
double tol)
Checks to see if a matrix is orthogonal or isometric.
|
static boolean |
isPositiveDefinite(org.ejml.data.DMatrixRMaj A)
Checks to see if the matrix is positive definite.
|
static boolean |
isPositiveSemidefinite(org.ejml.data.DMatrixRMaj A)
Checks to see if the matrix is positive semidefinite:
|
static boolean |
isRowsLinearIndependent(org.ejml.data.DMatrixRMaj A)
Checks to see if the rows of the provided matrix are linearly independent.
|
static boolean |
isSkewSymmetric(org.ejml.data.DMatrixRMaj A,
double tol)
Checks to see if a matrix is skew symmetric with in tolerance:
-A = AT or |aij + aji| ≤ tol |
static boolean |
isSquare(org.ejml.data.DMatrixD1 mat)
Checks to see if it is a square matrix.
|
static boolean |
isSymmetric(org.ejml.data.DMatrixRMaj m)
Returns true if the matrix is perfectly symmetric.
|
static boolean |
isSymmetric(org.ejml.data.DMatrixRMaj m,
double tol)
Returns true if the matrix is symmetric within the tolerance.
|
static boolean |
isUpperTriangle(org.ejml.data.DMatrixRMaj A,
int hessenberg,
double tol)
Checks to see if a matrix is upper triangular or Hessenberg.
|
static boolean |
isVector(org.ejml.data.Matrix mat)
Checks to see if the matrix is a vector or not.
|
static boolean |
isZeros(org.ejml.data.DMatrixD1 m,
double tol)
Checks to see all the elements in the matrix are zeros
|
static int |
nullity(org.ejml.data.DMatrixRMaj A)
Computes the nullity of a matrix using the default tolerance.
|
static int |
nullity(org.ejml.data.DMatrixRMaj A,
double threshold)
Computes the nullity of a matrix using the specified tolerance.
|
static int |
rank(org.ejml.data.DMatrixRMaj A)
Computes the rank of a matrix using a default tolerance.
|
static int |
rank(org.ejml.data.DMatrixRMaj A,
double threshold)
Computes the rank of a matrix using the specified tolerance.
|
public static boolean hasNaN(org.ejml.data.DMatrixD1 m)
m
- A matrix. Not modified.public static boolean hasUncountable(org.ejml.data.DMatrixD1 m)
m
- A matrix. Not modified.public static boolean isZeros(org.ejml.data.DMatrixD1 m, double tol)
m
- A matrix. Not modified.public static boolean isVector(org.ejml.data.Matrix mat)
mat
- A matrix. Not modified.public static boolean isPositiveDefinite(org.ejml.data.DMatrixRMaj A)
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 symmetric matrix.
A
- square symmetric matrix. Not modified.public static boolean isPositiveSemidefinite(org.ejml.data.DMatrixRMaj A)
Checks to see if the matrix is positive semidefinite:
xT A x ≥ 0
for all x where x is a non-zero vector and A is a symmetric matrix.
A
- square symmetric matrix. Not modified.public static boolean isSquare(org.ejml.data.DMatrixD1 mat)
mat
- A matrix. Not modified.public static boolean isSymmetric(org.ejml.data.DMatrixRMaj m, double tol)
Returns true if the matrix is symmetric within the tolerance. Only square matrices can be symmetric.
A matrix is symmetric if:
|aij - aji| ≤ tol
m
- A matrix. Not modified.tol
- Tolerance for how similar two elements need to be.public static boolean isSymmetric(org.ejml.data.DMatrixRMaj m)
Returns true if the matrix is perfectly symmetric. Only square matrices can be symmetric.
A matrix is symmetric if:
aij == aji
m
- A matrix. Not modified.public static boolean isSkewSymmetric(org.ejml.data.DMatrixRMaj A, double tol)
Checks to see if a matrix is skew symmetric with in tolerance:
-A = AT
or
|aij + aji| ≤ tol
A
- The matrix being tested.tol
- Tolerance for being skew symmetric.public static boolean isInverse(org.ejml.data.DMatrixRMaj a, org.ejml.data.DMatrixRMaj b, double tol)
a
- A matrix. Not modified.b
- A matrix. Not modified.public static boolean isEquals(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, double tol)
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 calling
isEquals(DMatrixD1, DMatrixD1)
a
- A matrix. Not modified.b
- A matrix. Not modified.tol
- How close to being identical each element needs to be.public static boolean isEqualsTriangle(org.ejml.data.DMatrix a, org.ejml.data.DMatrix b, boolean upper, double tol)
Checks to see if each element in the upper or lower triangular portion of 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 calling
isEquals(DMatrixD1, DMatrixD1)
a
- A matrix. Not modified.b
- A matrix. Not modified.upper
- true of upper triangular and false for lower.tol
- How close to being identical each element needs to be.public static boolean isEquals(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b)
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.
a
- A matrix. Not modified.b
- A matrix. Not modified.public static boolean isEquals(org.ejml.data.BMatrixRMaj a, org.ejml.data.BMatrixRMaj b)
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.
a
- A matrix. Not modified.b
- A matrix. Not modified.public static boolean isIdentical(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 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. 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.
a
- A matrix. Not modified.b
- A matrix. Not modified.tol
- Tolerance for equality.public static boolean isOrthogonal(org.ejml.data.DMatrixRMaj Q, double tol)
Checks to see if a matrix is orthogonal or isometric.
Q
- The matrix being tested. Not modified.tol
- Tolerance.public static boolean isRowsLinearIndependent(org.ejml.data.DMatrixRMaj A)
A
- Matrix whose rows are being tested for linear independence.public static boolean isIdentity(org.ejml.data.DMatrixRMaj mat, double tol)
mat
- Matrix being examined. Not modified.tol
- Tolerance.public static boolean isConstantVal(org.ejml.data.DMatrixRMaj mat, double val, double tol)
mat
- The matrix being tested. Not modified.val
- Checks to see if every element in the matrix has this value.tol
- True if all the elements are within this tolerance.public static boolean isDiagonalPositive(org.ejml.data.DMatrixRMaj a)
a
- A matrix. Not modified.public static boolean isFullRank(org.ejml.data.DMatrixRMaj a)
public static boolean isNegative(org.ejml.data.DMatrixD1 a, org.ejml.data.DMatrixD1 b, double tol)
Checks to see if the two matrices are the negative of each other:
aij = -bij
a
- First matrix. Not modified.b
- Second matrix. Not modified.tol
- Numerical tolerance.public static boolean isUpperTriangle(org.ejml.data.DMatrixRMaj A, int hessenberg, double tol)
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.
A
- Matrix being tested. Not modified.hessenberg
- The degree of being hessenberg.tol
- How close to zero the lower left elements need to be.public static boolean isLowerTriangle(org.ejml.data.DMatrixRMaj A, int hessenberg, double tol)
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.
A
- Matrix being tested. Not modified.hessenberg
- The degree of being hessenberg.tol
- How close to zero the lower left elements need to be.public static int rank(org.ejml.data.DMatrixRMaj A)
A
- Matrix whose rank is to be calculated. Not modified.public static int rank(org.ejml.data.DMatrixRMaj A, double threshold)
A
- Matrix whose rank is to be calculated. Not modified.threshold
- The numerical threshold used to determine a singular value.public static int nullity(org.ejml.data.DMatrixRMaj A)
A
- Matrix whose rank is to be calculated. Not modified.public static int nullity(org.ejml.data.DMatrixRMaj A, double threshold)
A
- Matrix whose rank is to be calculated. Not modified.threshold
- The numerical threshold used to determine a singular value.public static int countNonZero(org.ejml.data.DMatrixRMaj A)
A
- A matrix