blob: f04e48dc6ec7f458c01d83e04305f355695c937f [file] [log] [blame]
 LinearAlgebra (The Eclipse January API Documentation)
org.eclipse.january.dataset

Class LinearAlgebra

• Nested Class Summary

Nested Classes
Modifier and Type Class and Description
static class  LinearAlgebra.NormOrder
Order value for norm
• Constructor Summary

Constructors
Constructor and Description
LinearAlgebra()
• Method Summary

Methods
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
• Method Detail

• tensorDotProduct

public static Dataset tensorDotProduct(Dataset a,
Dataset b,
int axisa,
int axisb)
Calculate the tensor dot product over given axes. This is the sum of products of elements selected from the given axes in each dataset
Parameters:
a -
b -
axisa - axis dimension in a to sum over (can be -ve)
axisb - axis dimension in b to sum over (can be -ve)
Returns:
tensor dot product
• tensorDotProduct

public static Dataset tensorDotProduct(Dataset a,
Dataset b,
int[] axisa,
int[] axisb)
Calculate the tensor dot product over given axes. This is the sum of products of elements selected from the given axes in each dataset
Parameters:
a -
b -
axisa - axis dimensions in a to sum over (can be -ve)
axisb - axis dimensions in b to sum over (can be -ve)
Returns:
tensor dot product
• dotProduct

public static Dataset dotProduct(Dataset a,
Dataset b)
Calculate the dot product of two datasets. When b is a 1D dataset, the sum product over the last axis of a and b is returned. Where a is also a 1D dataset, a zero-rank dataset is returned. If b is 2D or higher, its second-to-last axis is used
Parameters:
a -
b -
Returns:
dot product
• crossProduct

public static Dataset crossProduct(Dataset a,
Dataset b)
Calculate the cross product of two datasets. Datasets must be broadcastable and possess last dimensions of length 2 or 3
Parameters:
a -
b -
Returns:
cross product
• crossProduct

public static Dataset crossProduct(Dataset a,
Dataset b,
int axisA,
int axisB,
int axisC)
Calculate the cross product of two datasets. Datasets must be broadcastable and possess dimensions of length 2 or 3. The axis parameters can be negative to indicate dimensions from the end of their shapes
Parameters:
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-product
Returns:
cross product
• power

public static Dataset power(Dataset a,
int n)
Raise dataset to given power by matrix multiplication
Parameters:
a -
n - power
Returns:
a ** n
• kroneckerProduct

public 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
Parameters:
a -
b -
Returns:
Kronecker product of a and b
• trace

public static Dataset trace(Dataset a)
Calculate trace of dataset - sum of values over 1st axis and 2nd axis
Parameters:
a -
Returns:
trace of dataset
• trace

public 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
Parameters:
a -
offset -
axis1 -
axis2 -
Returns:
trace of dataset
• norm

public static double norm(Dataset a)
Parameters:
a -
Returns:
norm of dataset
• norm

public static double norm(Dataset a,
double p)
Parameters:
a -
p -
Returns:
p-norm of dataset
• calcSingularValueDecomposition

public static Dataset[] calcSingularValueDecomposition(Dataset a)
Calculate singular value decomposition A = U S V^T
Parameters:
a -
Returns:
array of U - orthogonal matrix, s - singular values vector, V - orthogonal matrix
• calcMatrixRank

public static int calcMatrixRank(Dataset a)
Calculate matrix rank by singular value decomposition method
Parameters:
a -
Returns:
effective numerical rank of matrix
• calcConditionNumber

public static double calcConditionNumber(Dataset a)
Calculate condition number of matrix by singular value decomposition method
Parameters:
a -
Returns:
condition number
• calcDeterminant

public static double calcDeterminant(Dataset a)
Parameters:
a -
Returns:
determinant of dataset
• calcEigenvalues

public static Dataset calcEigenvalues(Dataset a)
Parameters:
a -
Returns:
dataset of eigenvalues (can be double or complex double)
• calcEigenDecomposition

public static Dataset[] calcEigenDecomposition(Dataset a)
Calculate eigen-decomposition A = V D V^T
Parameters:
a -
Returns:
array of D eigenvalues (can be double or complex double) and V eigenvectors
• calcInverse

public static Dataset calcInverse(Dataset a)
Calculate inverse of square dataset
Parameters:
a -
Returns:
inverse
• solveSVD

public static Dataset solveSVD(Dataset a,
Dataset v)
Solve least squares matrix equation A x = v by SVD
Parameters:
a -
v -
Returns:
x
• calcConjugateGradient

public 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
Parameters:
a -
v -
Returns:
solution of A^-1 v by conjugate gradient method
• calcConjugateGradient

public 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||
Parameters:
a -
v -
maxIterations -
delta - parameter used by stopping criterion
Returns:
solution of A^-1 v by conjugate gradient method

Copyright © 2017. All rights reserved.