public class NormOps_FDRM
extends java.lang.Object
Norms are a measure of the size of a vector or a matrix. One typical application is in error analysis.
Vector norms have the following properties:
Matrix norms can be induced from vector norms as is shown below:
||A||M = maxx≠0||Ax||v/||x||v
where ||.||M is the induced matrix norm for the vector norm ||.||v.
By default implementations that try to mitigate overflow/underflow are used. If the word fast is found before a function's name that means it does not mitigate those issues, but runs a bit faster.
Constructor and Description |
---|
NormOps_FDRM() |
Modifier and Type | Method and Description |
---|---|
static float |
conditionP(org.ejml.data.FMatrixRMaj A,
float p)
The condition number of a matrix is used to measure the sensitivity of the linear
system Ax=b.
|
static float |
conditionP2(org.ejml.data.FMatrixRMaj A)
The condition p = 2 number of a matrix is used to measure the sensitivity of the linear
system Ax=b.
|
static float |
elementP(org.ejml.data.FMatrix1Row A,
float p)
Element wise p-norm:
norm = {∑i=1:m ∑j=1:n { |aij|p}}1/p |
static float |
fastElementP(org.ejml.data.FMatrixD1 A,
float p)
Same as
elementP(org.ejml.data.FMatrix1Row, float) but runs faster by not mitigating overflow/underflow related problems. |
static float |
fastNormF(org.ejml.data.FMatrixD1 a)
This implementation of the Frobenius norm is a straight forward implementation and can
be susceptible for overflow/underflow issues.
|
static float |
fastNormP(org.ejml.data.FMatrixRMaj A,
float p)
An unsafe but faster version of
normP(org.ejml.data.FMatrixRMaj, float) that calls routines which are faster
but more prone to overflow/underflow problems. |
static float |
fastNormP2(org.ejml.data.FMatrixRMaj A)
Computes the p=2 norm.
|
static float |
inducedP1(org.ejml.data.FMatrixRMaj A)
Computes the induced p = 1 matrix norm.
||A||1= max(j=1 to n; sum(i=1 to m; |aij|)) |
static float |
inducedP2(org.ejml.data.FMatrixRMaj A)
Computes the induced p = 2 matrix norm, which is the largest singular value.
|
static float |
inducedPInf(org.ejml.data.FMatrixRMaj A)
Induced matrix p = infinity norm.
||A||∞ = max(i=1 to m; sum(j=1 to n; |aij|)) |
static void |
normalizeF(org.ejml.data.FMatrixRMaj A)
Normalizes the matrix such that the Frobenius norm is equal to one.
|
static float |
normF(org.ejml.data.FMatrixD1 a)
Computes the Frobenius matrix norm:
normF = Sqrt{ ∑i=1:m ∑j=1:n { aij2} } |
static float |
normP(org.ejml.data.FMatrixRMaj A,
float p)
Computes either the vector p-norm or the induced matrix p-norm depending on A
being a vector or a matrix respectively.
|
static float |
normP1(org.ejml.data.FMatrixRMaj A)
Computes the p=1 norm.
|
static float |
normP2(org.ejml.data.FMatrixRMaj A)
Computes the p=2 norm.
|
static float |
normPInf(org.ejml.data.FMatrixRMaj A)
Computes the p=∞ norm.
|
public static void normalizeF(org.ejml.data.FMatrixRMaj A)
A
- The matrix that is to be normalized.public static float conditionP(org.ejml.data.FMatrixRMaj A, float p)
The condition number of a matrix is used to measure the sensitivity of the linear
system Ax=b. A value near one indicates that it is a well conditioned matrix.
κp = ||A||p||A-1||p
If the matrix is not square then the condition of either ATA or AAT is computed.
A
- The matrix.p
- p-normpublic static float conditionP2(org.ejml.data.FMatrixRMaj A)
The condition p = 2 number of a matrix is used to measure the sensitivity of the linear
system Ax=b. A value near one indicates that it is a well conditioned matrix.
κ2 = ||A||2||A-1||2
This is also known as the spectral condition number.
A
- The matrix.public static float fastNormF(org.ejml.data.FMatrixD1 a)
This implementation of the Frobenius norm is a straight forward implementation and can
be susceptible for overflow/underflow issues. A more resilient implementation is
normF(org.ejml.data.FMatrixD1)
.
a
- The matrix whose norm is computed. Not modified.public static float normF(org.ejml.data.FMatrixD1 a)
Computes the Frobenius matrix norm:
normF = Sqrt{ ∑i=1:m ∑j=1:n { aij2} }
This is equivalent to the element wise p=2 norm. See fastNormF(org.ejml.data.FMatrixD1)
for another implementation
that is faster, but more prone to underflow/overflow errors.
a
- The matrix whose norm is computed. Not modified.public static float elementP(org.ejml.data.FMatrix1Row A, float p)
Element wise p-norm:
norm = {∑i=1:m ∑j=1:n { |aij|p}}1/p
This is not the same as the induced p-norm used on matrices, but is the same as the vector p-norm.
A
- Matrix. Not modified.p
- p value.public static float fastElementP(org.ejml.data.FMatrixD1 A, float p)
elementP(org.ejml.data.FMatrix1Row, float)
but runs faster by not mitigating overflow/underflow related problems.A
- Matrix. Not modified.p
- p value.public static float normP(org.ejml.data.FMatrixRMaj A, float p)
A
- Vector or matrix whose norm is to be computed.p
- The p value of the p-norm.public static float fastNormP(org.ejml.data.FMatrixRMaj A, float p)
normP(org.ejml.data.FMatrixRMaj, float)
that calls routines which are faster
but more prone to overflow/underflow problems.A
- Vector or matrix whose norm is to be computed.p
- The p value of the p-norm.public static float normP1(org.ejml.data.FMatrixRMaj A)
A
- Matrix or vector.public static float normP2(org.ejml.data.FMatrixRMaj A)
A
- Matrix or vector.public static float fastNormP2(org.ejml.data.FMatrixRMaj A)
A
- Matrix or vector.public static float normPInf(org.ejml.data.FMatrixRMaj A)
A
- Matrix or vector.public static float inducedP1(org.ejml.data.FMatrixRMaj A)
Computes the induced p = 1 matrix norm.
||A||1= max(j=1 to n; sum(i=1 to m; |aij|))
A
- Matrix. Not modified.public static float inducedP2(org.ejml.data.FMatrixRMaj A)
Computes the induced p = 2 matrix norm, which is the largest singular value.
A
- Matrix. Not modified.public static float inducedPInf(org.ejml.data.FMatrixRMaj A)
Induced matrix p = infinity norm.
||A||∞ = max(i=1 to m; sum(j=1 to n; |aij|))
A
- A matrix.