Package org.flag4j.linalg
Class MatrixNorms
java.lang.Object
org.flag4j.linalg.MatrixNorms
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
Computes the maximum/infinite norm of this tensor.static double
Computes the infinite norm of this matrix.private static double
matrixInfNorm
(double[] src, Shape shape) Computes the infinity/maximum norm of a matrix.private static double
matrixInfNorm
(CNumber[] src, Shape shape) Computes the infinity/maximum norm of a matrix.private static double
matrixMaxNorm
(double[] src) Computes the infinity/maximum norm of a matrix.private static double
matrixMaxNorm
(CNumber[] src) Computes the infinity/maximum norm of a matrix.private static double
matrixNormL2
(CNumber[] src, Shape shape) Compute the L2 norm of a matrix.private static double
matrixNormLp
(CNumber[] src, Shape shape, double p) Compute the Lp norm of a matrix.static double
matrixNormLpq
(double[] src, Shape shape, double p, double q) Compute the Lp, q norm of a matrix.static double
matrixNormLpq
(CsrMatrix src, double p, double q) Compute the Lp,q norm of a sparse CSR matrix.private static double
matrixNormLpq
(CNumber[] src, Shape shape, double p, double q) Compute the Lp, q norm of a matrix.static double
Computes the max norm of a matrix.static double
Computes the maximum norm of this matrix.static double
maxNorm
(CooCMatrix src) Computes the max norm of a matrix.static double
Computes the max norm of a matrix.static double
Computes the max norm of a matrix.static double
Computes the 2-norm of this tensor.static double
Computes the p-norm of this tensor.static double
Computes the Lp, q norm of this matrix.static double
Computes the 2-norm of this tensor.static double
Computes the p-norm of this tensor.static double
Computes the Lp, q norm of this matrix.static double
norm
(CooCMatrix src) Computes the 2-norm of this tensor.static double
norm
(CooCMatrix src, double p) Computes the p-norm of this tensor.static double
norm
(CooCMatrix src, double p, double q) Computes the Lp, q norm of this matrix.static double
Computes the 2-norm of this tensor.static double
Computes the p-norm of this tensor.static double
Computes the Lp, q norm of this matrix.double
Computes the 2-norm of this tensor.double
Computes the p-norm of this tensor.static double
Computes the Lp, q norm of this matrix.
-
Constructor Details
-
MatrixNorms
private MatrixNorms()
-
-
Method Details
-
norm
-
norm
Computes the p-norm of this tensor. Equivalent to callingnorm(p, p)
- Parameters:
src
- Matrix to compute norm of.p
- The p value in the p-norm.
- If p is inf, then this method computes the maximum/infinite norm.- Returns:
- The p-norm of this tensor.
- Throws:
IllegalArgumentException
- If p is less than 1.
-
maxNorm
Computes the maximum norm of this matrix. That is, the maximum value in the matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The maximum norm of this matrix.
- See Also:
-
infNorm
Computes the infinite norm of this matrix. that is the maximum row sum in the matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The infinite norm of this matrix.
- See Also:
-
norm
Computes the Lp, q norm of this matrix.- Parameters:
p
- P value in the Lp, q norm.q
- Q value in the Lp, q norm.- Returns:
- The Lp, q norm of this matrix.
-
norm
Computes the Lp, q norm of this matrix.- Parameters:
src
- Matrix to compute norm of.p
- P value in the Lp, q norm.q
- Q value in the Lp, q norm.- Returns:
- The Lp, q norm of this matrix.
-
maxNorm
Computes the max norm of a matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The max norm of this matrix.
-
norm
-
norm
Computes the p-norm of this tensor.- Parameters:
src
- Matrix to compute norm of.p
- The p value in the p-norm.
- If p is inf, then this method computes the maximum/infinite norm.- Returns:
- The p-norm of this tensor.
- Throws:
IllegalArgumentException
- If p is less than 1.
-
infNorm
Computes the maximum/infinite norm of this tensor.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The maximum/infinite norm of this tensor.
-
norm
Computes the Lp, q norm of this matrix.- Parameters:
src
- Matrix to compute norm of.p
- P value in the Lp, q norm.q
- Q value in the Lp, q norm.- Returns:
- The Lp, q norm of this matrix.
-
maxNorm
Computes the max norm of a matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The max norm of this matrix.
-
norm
-
norm
Computes the p-norm of this tensor.- Parameters:
src
- Matrix to compute norm of.p
- The p value in the p-norm.
- If p is inf, then this method computes the maximum/infinite norm.- Returns:
- The p-norm of this tensor.
- Throws:
IllegalArgumentException
- If p is less than 1.
-
norm
Computes the Lp, q norm of this matrix.- Parameters:
src
- Matrix to compute norm of.p
- P value in the Lp, q norm.q
- Q value in the Lp, q norm.- Returns:
- The Lp, q norm of this matrix.
-
maxNorm
Computes the max norm of a matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The max norm of this matrix.
-
norm
Computes the 2-norm of this tensor. This is equivalent tonorm(2)
.- Parameters:
src
- Matrix to compute the norm.- Returns:
- the 2-norm of this tensor.
-
norm
Computes the p-norm of this tensor.- Parameters:
src
- Matrix to compute the norm.p
- The p value in the p-norm.
- If p is inf, then this method computes the maximum/infinite norm.- Returns:
- The p-norm of this tensor.
- Throws:
IllegalArgumentException
- If p is less than 1.
-
norm
Computes the Lp, q norm of this matrix.- Parameters:
src
- Matrix to compute norm of.p
- P value in the Lp, q norm.q
- Q value in the Lp, q norm.- Returns:
- The Lp, q norm of this matrix.
-
maxNorm
Computes the max norm of a matrix.- Parameters:
src
- Matrix to compute norm of.- Returns:
- The max norm of this matrix.
-
norm
-
norm
Computes the p-norm of this tensor.- Parameters:
src
- Matrix to compute norm of.p
- The p value in the p-norm.
- If p is inf, then this method computes the maximum/infinite norm.- Returns:
- The p-norm of this tensor.
- Throws:
IllegalArgumentException
- If p is less than 1.
-
matrixMaxNorm
private static double matrixMaxNorm(double[] src) Computes the infinity/maximum norm of a matrix. That is, the maximum value in this matrix.- Parameters:
src
- Entries of the matrix.- Returns:
- The infinity norm of the matrix.
-
matrixInfNorm
Computes the infinity/maximum norm of a matrix. That is, the maximum value in this matrix.- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.- Returns:
- The infinity norm of the matrix.
-
matrixNormLpq
Compute the Lp, q norm of a matrix.- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.p
- First parameter in Lp, q norm.q
- Second parameter in Lp, q norm.- Returns:
- The Lp, q norm of the matrix.
- Throws:
IllegalArgumentException
- Ifp
orq
is less than 1.
-
matrixNormLp
Compute the Lp norm of a matrix. This is equivalent to passingq=1
tomatrixNormLpq(CNumber[], Shape, double, double)
- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.p
- Parameter in Lp norm.- Returns:
- The Lp norm of the matrix.
- Throws:
IllegalArgumentException
- Ifp
is less than 1.
-
matrixNormL2
Compute the L2 norm of a matrix. This is equivalent to passingq=1
tomatrixNormLpq(CNumber[], Shape, double, double)
- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.- Returns:
- The L2 norm of the matrix.
-
matrixMaxNorm
Computes the infinity/maximum norm of a matrix. That is, the maximum value in this matrix.- Parameters:
src
- Entries of the matrix.- Returns:
- The infinity norm of the matrix.
-
matrixInfNorm
-
matrixNormLpq
Compute the Lp,q norm of a sparse CSR matrix.- Parameters:
src
- Sparse CSR matrix to compute norm of.- Returns:
- The Lp,q norm of the matrix.
-
matrixNormLpq
Compute the Lp, q norm of a matrix.- Parameters:
src
- Entries of the matrix.shape
- Shape of the matrix.p
- First parameter in Lp, q norm.q
- Second parameter in Lp, q norm.- Returns:
- The Lp, q norm of the matrix.
- Throws:
IllegalArgumentException
- Ifp
orq
is less than 1.
-