Package org.nd4j.autodiff.samediff.ops
Class SDLinalg
- java.lang.Object
-
- org.nd4j.autodiff.samediff.ops.SDOps
-
- org.nd4j.autodiff.samediff.ops.SDLinalg
-
public class SDLinalg extends SDOps
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SDVariablecholesky(String name, SDVariable input)Computes the Cholesky decomposition of one or more square matrices.SDVariablecholesky(SDVariable input)Computes the Cholesky decomposition of one or more square matrices.SDVariablecross(String name, SDVariable a, SDVariable b)Computes pairwise cross product.SDVariablecross(SDVariable a, SDVariable b)Computes pairwise cross product.SDVariablediag(String name, SDVariable input)Calculates diagonal tensor.SDVariablediag(SDVariable input)Calculates diagonal tensor.SDVariablediag_part(String name, SDVariable input)Calculates diagonal tensor.SDVariablediag_part(SDVariable input)Calculates diagonal tensor.SDVariable[]eig(String[] names, SDVariable input)Calculates eigen valuesSDVariable[]eig(SDVariable input)Calculates eigen valuesSDVariablelogdet(String name, SDVariable input)Calculates log of determinant.SDVariablelogdet(SDVariable input)Calculates log of determinant.SDVariablelstsq(String name, SDVariable matrix, SDVariable rhs, double l2_reguralizer)Solver for linear squares problems.SDVariablelstsq(String name, SDVariable matrix, SDVariable rhs, double l2_reguralizer, boolean fast)Solver for linear squares problems.SDVariablelstsq(SDVariable matrix, SDVariable rhs, double l2_reguralizer)Solver for linear squares problems.SDVariablelstsq(SDVariable matrix, SDVariable rhs, double l2_reguralizer, boolean fast)Solver for linear squares problems.SDVariablelu(String name, SDVariable input)Computes LU decomposition.SDVariablelu(SDVariable input)Computes LU decomposition.SDVariablematmul(String name, SDVariable a, SDVariable b)Performs matrix mutiplication on input tensors.SDVariablematmul(SDVariable a, SDVariable b)Performs matrix mutiplication on input tensors.SDVariable[]matrixBandPart(String[] names, SDVariable input, int minLower, int maxUpper)Copy a tensor setting outside a central band in each innermost matrix.SDVariable[]matrixBandPart(SDVariable input, int minLower, int maxUpper)Copy a tensor setting outside a central band in each innermost matrix.SDVariablematrixDeterminant(String name, SDVariable input)Calculates matrix determinant.SDVariablematrixDeterminant(SDVariable input)Calculates matrix determinant.SDVariablematrixInverse(String name, SDVariable input)Inverts a matrixSDVariablematrixInverse(SDVariable input)Inverts a matrixSDVariablemmul(String name, SDVariable x, SDVariable y)Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariablemmul(String name, SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariablemmul(SDVariable x, SDVariable y)Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariablemmul(SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariable[]qr(String[] names, SDVariable input)Computes the QR decompositions of input matrix.SDVariable[]qr(String[] names, SDVariable input, boolean full)Computes the QR decompositions of input matrix.SDVariable[]qr(SDVariable input)Computes the QR decompositions of input matrix.SDVariable[]qr(SDVariable input, boolean full)Computes the QR decompositions of input matrix.SDVariablesolve(String name, SDVariable matrix, SDVariable rhs)Solver for systems of linear equations.SDVariablesolve(String name, SDVariable matrix, SDVariable rhs, boolean adjoint)Solver for systems of linear equations.SDVariablesolve(SDVariable matrix, SDVariable rhs)Solver for systems of linear equations.SDVariablesolve(SDVariable matrix, SDVariable rhs, boolean adjoint)Solver for systems of linear equations.SDVariablesvd(String name, SDVariable input, boolean fullUV, boolean computeUV)Calculates singular value decomposition.SDVariablesvd(String name, SDVariable input, boolean fullUV, boolean computeUV, int switchNum)Calculates singular value decomposition.SDVariablesvd(SDVariable input, boolean fullUV, boolean computeUV)Calculates singular value decomposition.SDVariablesvd(SDVariable input, boolean fullUV, boolean computeUV, int switchNum)Calculates singular value decomposition.SDVariabletri(int row, int column)An array with ones at and below the given diagonal and zeros elsewhere.SDVariabletri(String name, int row, int column)An array with ones at and below the given diagonal and zeros elsewhere.SDVariabletri(String name, DataType dataType, int row, int column, int diagonal)An array with ones at and below the given diagonal and zeros elsewhere.SDVariabletri(DataType dataType, int row, int column, int diagonal)An array with ones at and below the given diagonal and zeros elsewhere.SDVariabletriangularSolve(String name, SDVariable matrix, SDVariable rhs, boolean lower, boolean adjoint)Solver for systems of linear questions.SDVariabletriangularSolve(SDVariable matrix, SDVariable rhs, boolean lower, boolean adjoint)Solver for systems of linear questions.SDVariabletriu(String name, SDVariable input)Upper triangle of an array.SDVariabletriu(String name, SDVariable input, int diag)Upper triangle of an array.SDVariabletriu(SDVariable input)Upper triangle of an array.SDVariabletriu(SDVariable input, int diag)Upper triangle of an array.
-
-
-
Constructor Detail
-
SDLinalg
public SDLinalg(SameDiff sameDiff)
-
-
Method Detail
-
cholesky
public SDVariable cholesky(SDVariable input)
Computes the Cholesky decomposition of one or more square matrices.- Parameters:
input- Input tensor with inner-most 2 dimensions forming square matrices (NUMERIC type)- Returns:
- output Transformed tensor (NUMERIC type)
-
cholesky
public SDVariable cholesky(String name, SDVariable input)
Computes the Cholesky decomposition of one or more square matrices.- Parameters:
name- name May be null. Name for the output variableinput- Input tensor with inner-most 2 dimensions forming square matrices (NUMERIC type)- Returns:
- output Transformed tensor (NUMERIC type)
-
lstsq
public SDVariable lstsq(SDVariable matrix, SDVariable rhs, double l2_reguralizer, boolean fast)
Solver for linear squares problems.- Parameters:
matrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)l2_reguralizer- regularizerfast- fast mode, defaults to True- Returns:
- output Transformed tensor (FLOATING_POINT type)
-
lstsq
public SDVariable lstsq(String name, SDVariable matrix, SDVariable rhs, double l2_reguralizer, boolean fast)
Solver for linear squares problems.- Parameters:
name- name May be null. Name for the output variablematrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)l2_reguralizer- regularizerfast- fast mode, defaults to True- Returns:
- output Transformed tensor (FLOATING_POINT type)
-
lstsq
public SDVariable lstsq(SDVariable matrix, SDVariable rhs, double l2_reguralizer)
Solver for linear squares problems.- Parameters:
matrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)l2_reguralizer- regularizer- Returns:
- output Transformed tensor (FLOATING_POINT type)
-
lstsq
public SDVariable lstsq(String name, SDVariable matrix, SDVariable rhs, double l2_reguralizer)
Solver for linear squares problems.- Parameters:
name- name May be null. Name for the output variablematrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)l2_reguralizer- regularizer- Returns:
- output Transformed tensor (FLOATING_POINT type)
-
lu
public SDVariable lu(SDVariable input)
Computes LU decomposition.- Parameters:
input- input tensor (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
lu
public SDVariable lu(String name, SDVariable input)
Computes LU decomposition.- Parameters:
name- name May be null. Name for the output variableinput- input tensor (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matmul
public SDVariable matmul(SDVariable a, SDVariable b)
Performs matrix mutiplication on input tensors.- Parameters:
a- input tensor (NUMERIC type)b- input tensor (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matmul
public SDVariable matmul(String name, SDVariable a, SDVariable b)
Performs matrix mutiplication on input tensors.- Parameters:
name- name May be null. Name for the output variablea- input tensor (NUMERIC type)b- input tensor (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matrixBandPart
public SDVariable[] matrixBandPart(SDVariable input, int minLower, int maxUpper)
Copy a tensor setting outside a central band in each innermost matrix.- Parameters:
input- input tensor (NUMERIC type)minLower- lower diagonal countmaxUpper- upper diagonal count
-
matrixBandPart
public SDVariable[] matrixBandPart(String[] names, SDVariable input, int minLower, int maxUpper)
Copy a tensor setting outside a central band in each innermost matrix.- Parameters:
names- names May be null. Arrays of names for the output variables.input- input tensor (NUMERIC type)minLower- lower diagonal countmaxUpper- upper diagonal count
-
qr
public SDVariable[] qr(SDVariable input, boolean full)
Computes the QR decompositions of input matrix.- Parameters:
input- input tensor (NUMERIC type)full- full matrices mode
-
qr
public SDVariable[] qr(String[] names, SDVariable input, boolean full)
Computes the QR decompositions of input matrix.- Parameters:
names- names May be null. Arrays of names for the output variables.input- input tensor (NUMERIC type)full- full matrices mode
-
qr
public SDVariable[] qr(SDVariable input)
Computes the QR decompositions of input matrix.- Parameters:
input- input tensor (NUMERIC type)
-
qr
public SDVariable[] qr(String[] names, SDVariable input)
Computes the QR decompositions of input matrix.- Parameters:
names- names May be null. Arrays of names for the output variables.input- input tensor (NUMERIC type)
-
solve
public SDVariable solve(SDVariable matrix, SDVariable rhs, boolean adjoint)
Solver for systems of linear equations.- Parameters:
matrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)adjoint- adjoint mode, defaults to False- Returns:
- output Output tensor (FLOATING_POINT type)
-
solve
public SDVariable solve(String name, SDVariable matrix, SDVariable rhs, boolean adjoint)
Solver for systems of linear equations.- Parameters:
name- name May be null. Name for the output variablematrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)adjoint- adjoint mode, defaults to False- Returns:
- output Output tensor (FLOATING_POINT type)
-
solve
public SDVariable solve(SDVariable matrix, SDVariable rhs)
Solver for systems of linear equations.- Parameters:
matrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)- Returns:
- output Output tensor (FLOATING_POINT type)
-
solve
public SDVariable solve(String name, SDVariable matrix, SDVariable rhs)
Solver for systems of linear equations.- Parameters:
name- name May be null. Name for the output variablematrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)- Returns:
- output Output tensor (FLOATING_POINT type)
-
triangularSolve
public SDVariable triangularSolve(SDVariable matrix, SDVariable rhs, boolean lower, boolean adjoint)
Solver for systems of linear questions.- Parameters:
matrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)lower- defines whether innermost matrices in matrix are lower or upper triangularadjoint- adjoint mode- Returns:
- output (FLOATING_POINT type)
-
triangularSolve
public SDVariable triangularSolve(String name, SDVariable matrix, SDVariable rhs, boolean lower, boolean adjoint)
Solver for systems of linear questions.- Parameters:
name- name May be null. Name for the output variablematrix- input tensor (NUMERIC type)rhs- input tensor (NUMERIC type)lower- defines whether innermost matrices in matrix are lower or upper triangularadjoint- adjoint mode- Returns:
- output (FLOATING_POINT type)
-
cross
public SDVariable cross(SDVariable a, SDVariable b)
Computes pairwise cross product.- Parameters:
a- (NUMERIC type)b- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
cross
public SDVariable cross(String name, SDVariable a, SDVariable b)
Computes pairwise cross product.- Parameters:
name- name May be null. Name for the output variablea- (NUMERIC type)b- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
diag
public SDVariable diag(SDVariable input)
Calculates diagonal tensor.- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
diag
public SDVariable diag(String name, SDVariable input)
Calculates diagonal tensor.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
diag_part
public SDVariable diag_part(SDVariable input)
Calculates diagonal tensor.- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
diag_part
public SDVariable diag_part(String name, SDVariable input)
Calculates diagonal tensor.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
eig
public SDVariable[] eig(SDVariable input)
Calculates eigen values- Parameters:
input- (NUMERIC type)
-
eig
public SDVariable[] eig(String[] names, SDVariable input)
Calculates eigen values- Parameters:
names- names May be null. Arrays of names for the output variables.input- (NUMERIC type)
-
logdet
public SDVariable logdet(SDVariable input)
Calculates log of determinant.- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
logdet
public SDVariable logdet(String name, SDVariable input)
Calculates log of determinant.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matrixDeterminant
public SDVariable matrixDeterminant(SDVariable input)
Calculates matrix determinant.- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matrixDeterminant
public SDVariable matrixDeterminant(String name, SDVariable input)
Calculates matrix determinant.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matrixInverse
public SDVariable matrixInverse(SDVariable input)
Inverts a matrix- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
matrixInverse
public SDVariable matrixInverse(String name, SDVariable input)
Inverts a matrix- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
mmul
public SDVariable mmul(SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
x- First input variable (NUMERIC type)y- Second input variable (NUMERIC type)transposeX- Transpose x (first argument)transposeY- Transpose y (second argument)transposeZ- Transpose result array- Returns:
- output (NUMERIC type)
-
mmul
public SDVariable mmul(String name, SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
name- name May be null. Name for the output variablex- First input variable (NUMERIC type)y- Second input variable (NUMERIC type)transposeX- Transpose x (first argument)transposeY- Transpose y (second argument)transposeZ- Transpose result array- Returns:
- output (NUMERIC type)
-
mmul
public SDVariable mmul(SDVariable x, SDVariable y)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
x- First input variable (NUMERIC type)y- Second input variable (NUMERIC type)- Returns:
- output (NUMERIC type)
-
mmul
public SDVariable mmul(String name, SDVariable x, SDVariable y)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
name- name May be null. Name for the output variablex- First input variable (NUMERIC type)y- Second input variable (NUMERIC type)- Returns:
- output (NUMERIC type)
-
svd
public SDVariable svd(SDVariable input, boolean fullUV, boolean computeUV, int switchNum)
Calculates singular value decomposition.- Parameters:
input- (NUMERIC type)fullUV-computeUV-switchNum-- Returns:
- output (FLOATING_POINT type)
-
svd
public SDVariable svd(String name, SDVariable input, boolean fullUV, boolean computeUV, int switchNum)
Calculates singular value decomposition.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)fullUV-computeUV-switchNum-- Returns:
- output (FLOATING_POINT type)
-
svd
public SDVariable svd(SDVariable input, boolean fullUV, boolean computeUV)
Calculates singular value decomposition.- Parameters:
input- (NUMERIC type)fullUV-computeUV-- Returns:
- output (FLOATING_POINT type)
-
svd
public SDVariable svd(String name, SDVariable input, boolean fullUV, boolean computeUV)
Calculates singular value decomposition.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)fullUV-computeUV-- Returns:
- output (FLOATING_POINT type)
-
tri
public SDVariable tri(DataType dataType, int row, int column, int diagonal)
An array with ones at and below the given diagonal and zeros elsewhere.- Parameters:
dataType- Data typerow-column-diagonal-- Returns:
- output (FLOATING_POINT type)
-
tri
public SDVariable tri(String name, DataType dataType, int row, int column, int diagonal)
An array with ones at and below the given diagonal and zeros elsewhere.- Parameters:
name- name May be null. Name for the output variabledataType- Data typerow-column-diagonal-- Returns:
- output (FLOATING_POINT type)
-
tri
public SDVariable tri(int row, int column)
An array with ones at and below the given diagonal and zeros elsewhere.- Parameters:
row-column-- Returns:
- output (FLOATING_POINT type)
-
tri
public SDVariable tri(String name, int row, int column)
An array with ones at and below the given diagonal and zeros elsewhere.- Parameters:
name- name May be null. Name for the output variablerow-column-- Returns:
- output (FLOATING_POINT type)
-
triu
public SDVariable triu(SDVariable input, int diag)
Upper triangle of an array. Return a copy of a input tensor with the elements below the k-th diagonal zeroed.- Parameters:
input- (NUMERIC type)diag-- Returns:
- output (FLOATING_POINT type)
-
triu
public SDVariable triu(String name, SDVariable input, int diag)
Upper triangle of an array. Return a copy of a input tensor with the elements below the k-th diagonal zeroed.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)diag-- Returns:
- output (FLOATING_POINT type)
-
triu
public SDVariable triu(SDVariable input)
Upper triangle of an array. Return a copy of a input tensor with the elements below the k-th diagonal zeroed.- Parameters:
input- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
triu
public SDVariable triu(String name, SDVariable input)
Upper triangle of an array. Return a copy of a input tensor with the elements below the k-th diagonal zeroed.- Parameters:
name- name May be null. Name for the output variableinput- (NUMERIC type)- Returns:
- output (FLOATING_POINT type)
-
-