public class LinearAlgebra extends Object
Modifier and Type | Class and Description |
---|---|
static class |
LinearAlgebra.NormOrder
Order value for norm
|
Constructor and Description |
---|
LinearAlgebra() |
Modifier and Type | Method and Description |
---|---|
static Dataset |
calcCholeskyDecomposition(Dataset a)
Calculate Cholesky decomposition
A = L L^T |
static double |
calcConditionNumber(Dataset a)
Calculate condition number of matrix by singular value decomposition method
|
static Dataset |
calcConjugateGradient(Dataset a,
Dataset v)
Calculation
A x = v by conjugate gradient method with the stopping criterion being
that the estimated residual r = v - A x satisfies ||r|| < ||v|| with maximum of 100 iterations |
static Dataset |
calcConjugateGradient(Dataset a,
Dataset v,
int maxIterations,
double delta)
Calculation
A x = v by conjugate gradient method with the stopping criterion being
that the estimated residual r = v - A x satisfies ||r|| < delta ||v|| |
static double |
calcDeterminant(Dataset a) |
static Dataset[] |
calcEigenDecomposition(Dataset a)
Calculate eigen-decomposition
A = V D V^T |
static Dataset |
calcEigenvalues(Dataset a) |
static Dataset |
calcInverse(Dataset a)
Calculate inverse of square dataset
|
static Dataset[] |
calcLUDecomposition(Dataset a)
Calculate LU decomposition
A = P^-1 L U |
static int |
calcMatrixRank(Dataset a)
Calculate matrix rank by singular value decomposition method
|
static Dataset |
calcPseudoInverse(Dataset a)
Calculate (Moore-Penrose) pseudo-inverse
|
static Dataset[] |
calcQRDecomposition(Dataset a)
Calculate QR decomposition
A = Q R |
static Dataset[] |
calcSingularValueDecomposition(Dataset a)
Calculate singular value decomposition
A = U S V^T |
static double[] |
calcSingularValues(Dataset a) |
static Dataset |
crossProduct(Dataset a,
Dataset b)
Calculate the cross product of two datasets.
|
static Dataset |
crossProduct(Dataset a,
Dataset b,
int axisA,
int axisB,
int axisC)
Calculate the cross product of two datasets.
|
static Dataset |
dotProduct(Dataset a,
Dataset b)
Calculate the dot product of two datasets.
|
static Dataset |
kroneckerProduct(Dataset a,
Dataset b)
Create the Kronecker product as defined by
kron[k0,...,kN] = a[i0,...,iN] * b[j0,...,jN]
where kn = sn * in + jn for n = 0...N and s is shape of b |
static double |
norm(Dataset a) |
static double |
norm(Dataset a,
double p) |
static double |
norm(Dataset a,
LinearAlgebra.NormOrder order) |
static Dataset |
outerProduct(Dataset a,
Dataset b)
Calculate the outer product of two datasets
|
static Dataset |
power(Dataset a,
int n)
Raise dataset to given power by matrix multiplication
|
static Dataset |
solve(Dataset a,
Dataset v)
Solve linear matrix equation
A x = v |
static Dataset |
solveSVD(Dataset a,
Dataset v)
Solve least squares matrix equation
A x = v by SVD |
static Dataset |
tensorDotProduct(Dataset a,
Dataset b,
int[] axisa,
int[] axisb)
Calculate the tensor dot product over given axes.
|
static Dataset |
tensorDotProduct(Dataset a,
Dataset b,
int axisa,
int axisb)
Calculate the tensor dot product over given axes.
|
static Dataset |
trace(Dataset a)
Calculate trace of dataset - sum of values over 1st axis and 2nd axis
|
static Dataset |
trace(Dataset a,
int offset,
int axis1,
int axis2)
Calculate trace of dataset - sum of values over axis1 and axis2 where axis2 is offset
|
public LinearAlgebra()
public static Dataset tensorDotProduct(Dataset a, Dataset b, int axisa, int axisb)
a
- b
- axisa
- axis dimension in a to sum over (can be -ve)axisb
- axis dimension in b to sum over (can be -ve)public static Dataset tensorDotProduct(Dataset a, Dataset b, int[] axisa, int[] axisb)
a
- b
- axisa
- axis dimensions in a to sum over (can be -ve)axisb
- axis dimensions in b to sum over (can be -ve)public static Dataset dotProduct(Dataset a, Dataset b)
a
- b
- public static Dataset outerProduct(Dataset a, Dataset b)
a
- b
- public static Dataset crossProduct(Dataset a, Dataset b)
a
- b
- public static Dataset crossProduct(Dataset a, Dataset b, int axisA, int axisB, int axisC)
a
- b
- axisA
- dimension to be used a vector (must have length of 2 or 3)axisB
- dimension to be used a vector (must have length of 2 or 3)axisC
- dimension to assign as cross-productpublic static Dataset power(Dataset a, int n)
a
- n
- powera ** n
public static Dataset kroneckerProduct(Dataset a, Dataset b)
kron[k0,...,kN] = a[i0,...,iN] * b[j0,...,jN]
where kn = sn * in + jn
for n = 0...N
and s
is shape of b
a
- b
- public static Dataset trace(Dataset a)
a
- public static Dataset trace(Dataset a, int offset, int axis1, int axis2)
a
- offset
- axis1
- axis2
- public static double norm(Dataset a, LinearAlgebra.NormOrder order)
a
- order
- public static double[] calcSingularValues(Dataset a)
a
- public static Dataset[] calcSingularValueDecomposition(Dataset a)
A = U S V^T
a
- public static Dataset calcPseudoInverse(Dataset a)
a
- public static int calcMatrixRank(Dataset a)
a
- public static double calcConditionNumber(Dataset a)
a
- public static double calcDeterminant(Dataset a)
a
- public static Dataset calcEigenvalues(Dataset a)
a
- public static Dataset[] calcEigenDecomposition(Dataset a)
A = V D V^T
a
- public static Dataset[] calcQRDecomposition(Dataset a)
A = Q R
a
- public static Dataset[] calcLUDecomposition(Dataset a)
A = P^-1 L U
a
- public static Dataset calcInverse(Dataset a)
a
- public static Dataset solve(Dataset a, Dataset v)
A x = v
a
- v
- public static Dataset solveSVD(Dataset a, Dataset v)
A x = v
by SVDa
- v
- public static Dataset calcCholeskyDecomposition(Dataset a)
A = L L^T
a
- public static Dataset calcConjugateGradient(Dataset a, Dataset v)
A x = v
by conjugate gradient method with the stopping criterion being
that the estimated residual r = v - A x
satisfies ||r|| < ||v||
with maximum of 100 iterationsa
- v
- A^-1 v
by conjugate gradient methodpublic static Dataset calcConjugateGradient(Dataset a, Dataset v, int maxIterations, double delta)
A x = v
by conjugate gradient method with the stopping criterion being
that the estimated residual r = v - A x
satisfies ||r|| < delta ||v||
a
- v
- maxIterations
- delta
- parameter used by stopping criterionA^-1 v
by conjugate gradient methodCopyright © 2014–2019 Eclipse Foundation. All rights reserved.