public class MathTools extends Object
Constructor and Description |
---|
MathTools() |
Modifier and Type | Method and Description |
---|---|
static double[][] |
antiSymmetricPadding(double[][] c,
int extra) |
static double[] |
antiSymmetricPadding(double[] c,
int n,
int extra) |
static float[] |
antiSymmetricPadding(float[] c,
int n,
int extra) |
static double |
Bspline01(double x)
B-spline 01.
|
static double |
Bspline02(double x)
B-spline 02.
|
static double |
Bspline03(double x)
B-spline 03.
|
static double |
EuclideanNorm(double a,
double b)
Euclidean Norm.
|
static boolean |
invertMatrixSVD(int Ydim,
int Xdim,
double[][] B,
double[][] iB)
Invert a matrix by the Singular Value Decomposition method.
|
static double[] |
linearLeastSquares(double[][] A,
double[] b)
Gives the least-squares solution to (A * x = b) such that
(A^T * A)^-1 * A^T * b = x is a vector of size (column), where A is
a (line x column) matrix, and where b is a vector of size (line).
|
static double |
nchoosek(int n,
int k)
N choose K.
|
static void |
QRdecomposition(double[][] Q,
double[][] R)
Decomposes the (line x column) input matrix Q into an orthonormal
output matrix Q of same size (line x column) and an upper-diagonal
square matrix R of size (column x column), such that the matrix
product (Q * R) gives the input matrix, and such that the matrix
product (Q^T * Q) gives the identity.
|
static void |
showMatrix(int Ydim,
int Xdim,
double[][] A)
Method to display the matrix in the command line.
|
static void |
singularValueBackSubstitution(double[][] U,
double[] W,
double[][] V,
double[] B,
double[] X)
solve (U.W.Transpose(V)).X == B in terms of X
{U, W, V} are given by SingularValueDecomposition
by convention, set w[i,j]=0 to get (1/w[i,j])=0
the size of the input matrix U is (Lines x Columns)
the size of the vector (1/W) of singular values is (Columns)
the size of the untransposed orthogonal matrix V is (Columns x Columns)
the size of the input vector B is (Lines)
the size of the output vector X is (Columns)
|
static void |
singularValueDecomposition(double[][] U,
double[] W,
double[][] V)
Singular Value Decomposition.
|
public static double Bspline01(double x)
x
- public static double Bspline02(double x)
x
- public static double Bspline03(double x)
x
- public static double EuclideanNorm(double a, double b)
a
- b
- public static boolean invertMatrixSVD(int Ydim, int Xdim, double[][] B, double[][] iB)
Ydim
- input, Y-dimensionXdim
- input, X-dimensionB
- input, matrix to invertiB
- output, inverted matrixpublic static double[] linearLeastSquares(double[][] A, double[] b)
A
- An input matrix A[line][column] of size (line x column)b
- An input vector b[line] of size (line)public static double nchoosek(int n, int k)
n
- k
- public static void QRdecomposition(double[][] Q, double[][] R)
Q
- An in-place (line x column) matrix Q[line][column], which
expects as input the matrix to decompose, and which returns as
output an orthonormal matrixR
- An output (column x column) square matrix R[column][column]public static void showMatrix(int Ydim, int Xdim, double[][] A)
Ydim
- Y-dimensionXdim
- X-dimensionA
- matrix to displaypublic static void singularValueDecomposition(double[][] U, double[] W, double[][] V)
U
- input matrixW
- vector of singular valuesV
- untransposed orthogonal matrixpublic static void singularValueBackSubstitution(double[][] U, double[] W, double[][] V, double[] B, double[] X)
U
- input matrixW
- vector of singular valuesV
- untransposed orthogonal matrixB
- input vectorX
- returned solutionpublic static double[][] antiSymmetricPadding(double[][] c, int extra)
public static double[] antiSymmetricPadding(double[] c, int n, int extra)
public static float[] antiSymmetricPadding(float[] c, int n, int extra)
Copyright © 2015–2021 Fiji. All rights reserved.