public class LinearAlgebraUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LinearAlgebraUtils.BMulInPlaceTask
Computes B = XY where X is n by k and Y is k by p, saving result in same frame
Input: [X,B] (large frame) passed to doAll, where we write to B
yt = Y' = transpose of Y (small matrix)
ncolX = number of columns in X
|
static class |
LinearAlgebraUtils.BMulTask
Computes B = XY where X is n by k and Y is k by p, saving result in new vecs
Input: dinfo = X (large frame) with dinfo._adaptedFrame passed to doAll
yt = Y' = transpose of Y (small matrix)
Output: XY (large frame) is n by p
|
static class |
LinearAlgebraUtils.BMulTaskMatrices
Compute B = XY where where X is n by k and Y is k by p and they are both stored as Frames.
|
static class |
LinearAlgebraUtils.CopyQtoQMatrix |
static class |
LinearAlgebraUtils.FindMaxIndex |
static class |
LinearAlgebraUtils.ForwardSolve
Given lower triangular L, solve for Q in QL' = A (LQ' = A') using forward substitution
Dimensions: A is n by p, Q is n by p, R = L' is p by p
Input: [A,Q] (large frame) passed to doAll, where we write to Q
|
static class |
LinearAlgebraUtils.ForwardSolveInPlace
Given lower triangular L, solve for Q in QL' = A (LQ' = A') using forward substitution
Dimensions: A is n by p, Q is n by p, R = L' is p by p
Input: A (large frame) passed to doAll, where we overwrite each row of A with its row of Q
|
static class |
LinearAlgebraUtils.SMulTask
Computes A'Q where A is n by p and Q is n by k
Input: [A,Q] (large frame) passed to doAll
Output: atq = A'Q (small matrix) is \tilde{p} by k where \tilde{p} = number of cols in A with categoricals expanded
|
Modifier and Type | Field and Description |
---|---|
static hex.ToEigenVec |
toEigen |
Constructor and Description |
---|
LinearAlgebraUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
applyGramSchmit(double[][] matT) |
static double[] |
backwardSolve(double[][] L,
double[] b,
double[] res) |
static double[][] |
chol2Inv(double[][] cholR)
Given the cholesky decomposition of X = QR, this method will return the inverse of
transpose(X)*X by attempting to solve for transpose(R)*R*XTX_inverse = Identity matrix
|
static double[][] |
chol2Inv(double[][] cholR,
boolean upperTriag) |
static void |
choleskySymDiagMat(double[][] xx)
compute the cholesky of xx which stores the lower part of a symmetric square tridiagonal matrix.
|
static double[][] |
computeQ(water.Key<water.Job> jobKey,
DataInfo yinfo,
water.fvec.Frame ywfrm) |
static double |
computeQ(water.Key<water.Job> jobKey,
DataInfo yinfo,
water.fvec.Frame ywfrm,
double[][] xx)
Solve for Q from Y = QR factorization and write into new frame
|
static double[][] |
computeQInPlace(water.Key<water.Job> jobKey,
DataInfo yinfo)
Solve for Q from Y = QR factorization and write into Y frame
|
static double[][] |
computeR(water.Key<water.Job> jobKey,
DataInfo yinfo,
boolean transpose)
Get R = L' from Cholesky decomposition Y'Y = LL' (same as R from Y = QR)
|
static EigenPair[] |
createReverseSortedEigenpairs(double[] eigenvalues,
double[][] eigenvectors) |
static EigenPair[] |
createSortedEigenpairs(double[] eigenvalues,
double[][] eigenvectors) |
static double[][] |
expandLowTrian2Ful(double[][] cholL) |
static double[] |
expandRow(double[] row,
DataInfo dinfo,
double[] tmp,
boolean modify_numeric) |
static double[] |
extractEigenvaluesFromEigenpairs(EigenPair[] eigenPairs) |
static double[][] |
extractEigenvectorsFromEigenpairs(EigenPair[] eigenPairs) |
static double[] |
forwardSolve(double[][] L,
double[] b) |
static double[][] |
generateIdentityMat(int size) |
static double[][] |
generateOrthogonalComplement(double[][] orthMat,
double[][] starT,
int numBasis,
long seed)
Given an matrix, a QR decomposition is carried out to the matrix as starT = QR.
|
static double[][] |
generateQR(double[][] starT) |
static double[][] |
generateTriDiagMatrix(double[] hj)
Generate D matrix as a lower diagonal matrix since it is symmetric and contains only 3 diagonals
|
static void |
genInnerProduct(double[][] mat,
double[] vector,
double[] innerProd) |
static java.lang.String |
getMatrixInString(double[][] matrix) |
static double[][] |
matrixMultiply(double[][] A,
double[][] B) |
static double[][] |
matrixMultiplyTriagonal(double[][] A,
TriDiagonalMatrix B,
boolean transposeResult) |
static int |
numColsExp(water.fvec.Frame fr,
boolean useAllFactorLevels)
Number of columns with categoricals expanded.
|
static double[][] |
reshape1DArray(double[] arr,
int m,
int n) |
static double[] |
sqrtDiag(double[][] aMat)
Given a matrix aMat as a double [][] array, this function will return an array that is the
square root of the diagonals of aMat.
|
static water.fvec.Vec |
toEigen(water.fvec.Vec src) |
static double[] |
toEigenArray(water.fvec.Vec src) |
static double[] |
toEigenProjectionArray(water.fvec.Frame _origTrain,
water.fvec.Frame _train,
boolean expensive) |
public static double[] forwardSolve(double[][] L, double[] b)
public static double[] sqrtDiag(double[][] aMat)
aMat
- public static double[][] chol2Inv(double[][] cholR, boolean upperTriag)
public static double[][] chol2Inv(double[][] cholR)
cholR
- public static double[][] generateTriDiagMatrix(double[] hj)
hj
- public static double[][] generateOrthogonalComplement(double[][] orthMat, double[][] starT, int numBasis, long seed)
starT:
- double array that will have a QR decomposition carried out onnumBasis:
- integer denoting number of basis in the orthogonal complementpublic static double[][] generateIdentityMat(int size)
public static double[][] generateQR(double[][] starT)
public static void genInnerProduct(double[][] mat, double[] vector, double[] innerProd)
public static void applyGramSchmit(double[][] matT)
public static double[][] expandLowTrian2Ful(double[][] cholL)
public static double[][] matrixMultiply(double[][] A, double[][] B)
public static double[][] matrixMultiplyTriagonal(double[][] A, TriDiagonalMatrix B, boolean transposeResult)
A
- B
- transposeResult:
- true will return A*B. Otherwise will return transpose(A*B)public static double[] backwardSolve(double[][] L, double[] b, double[] res)
public static double[] expandRow(double[] row, DataInfo dinfo, double[] tmp, boolean modify_numeric)
public static double[][] reshape1DArray(double[] arr, int m, int n)
public static EigenPair[] createSortedEigenpairs(double[] eigenvalues, double[][] eigenvectors)
public static EigenPair[] createReverseSortedEigenpairs(double[] eigenvalues, double[][] eigenvectors)
public static double[] extractEigenvaluesFromEigenpairs(EigenPair[] eigenPairs)
public static double[][] extractEigenvectorsFromEigenpairs(EigenPair[] eigenPairs)
public static void choleskySymDiagMat(double[][] xx)
xx
- public static double[][] computeR(water.Key<water.Job> jobKey, DataInfo yinfo, boolean transpose)
jobKey
- Job key for Gram calculationyinfo
- DataInfo for Y matrixtranspose
- Should result be transposed to get L?public static double computeQ(water.Key<water.Job> jobKey, DataInfo yinfo, water.fvec.Frame ywfrm, double[][] xx)
jobKey
- Job key for Gram calculationyinfo
- DataInfo for Y matrixywfrm
- Input frame [Y,W] where we write into Wpublic static double[][] computeQ(water.Key<water.Job> jobKey, DataInfo yinfo, water.fvec.Frame ywfrm)
public static double[][] computeQInPlace(water.Key<water.Job> jobKey, DataInfo yinfo)
jobKey
- Job key for Gram calculationyinfo
- DataInfo for Y matrixpublic static int numColsExp(water.fvec.Frame fr, boolean useAllFactorLevels)
public static double[] toEigenArray(water.fvec.Vec src)
public static water.fvec.Vec toEigen(water.fvec.Vec src)
public static double[] toEigenProjectionArray(water.fvec.Frame _origTrain, water.fvec.Frame _train, boolean expensive)
public static java.lang.String getMatrixInString(double[][] matrix)