public class CommonOps_DSCC
extends java.lang.Object
| Constructor and Description |
|---|
CommonOps_DSCC() |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(double alpha,
org.ejml.data.DMatrixSparseCSC A,
double beta,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Performs matrix addition:
C = αA + βB |
static void |
changeSign(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
B = -A.
|
static boolean |
checkDuplicateElements(org.ejml.data.DMatrixSparseCSC A)
Checks for duplicate elements.
|
static boolean |
checkIndicesSorted(org.ejml.data.DMatrixSparseCSC A)
Checks to see if row indicies are sorted into ascending order.
|
static boolean |
checkSortedFlag(org.ejml.data.DMatrixSparseCSC A) |
static boolean |
checkStructure(org.ejml.data.DMatrixSparseCSC A) |
static void |
columnMaxAbs(org.ejml.data.DMatrixSparseCSC A,
double[] values)
Finds the maximum abs in each column of A and stores it into values
|
static org.ejml.data.DMatrixSparseCSC |
concatColumns(org.ejml.data.DMatrixSparseCSC left,
org.ejml.data.DMatrixSparseCSC right,
org.ejml.data.DMatrixSparseCSC out)
Concats two matrices along their columns (horizontal).
|
static org.ejml.data.DMatrixSparseCSC |
concatRows(org.ejml.data.DMatrixSparseCSC top,
org.ejml.data.DMatrixSparseCSC bottom,
org.ejml.data.DMatrixSparseCSC out)
Concats two matrices along their rows (vertical).
|
static double |
det(org.ejml.data.DMatrixSparseCSC A)
Returns the determinant of the matrix.
|
static org.ejml.data.DMatrixSparseCSC |
diag(org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset,
int length)
Creates a diagonal matrix from an array.
|
static org.ejml.data.DMatrixSparseCSC |
diag(double... values)
Returns a diagonal matrix with the specified diagonal elements.
|
static void |
divide(org.ejml.data.DMatrixSparseCSC A,
double scalar,
org.ejml.data.DMatrixSparseCSC B)
B = A/scalar.
|
static void |
divide(double scalar,
org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
B = scalar/A.
|
static void |
divideColumns(org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset)
Divides all elements of column 'i' by values[i].
|
static void |
divideRows(double[] diag,
int offset,
org.ejml.data.DMatrixSparseCSC A)
Divides all elements of row 'i' by value[i].
|
static void |
divideRowsCols(double[] diagA,
int offsetA,
org.ejml.data.DMatrixSparseCSC B,
double[] diagC,
int offsetC)
Equivalent to multiplying a matrix B by the inverse of two diagonal matrices.
|
static double |
dotInnerColumns(org.ejml.data.DMatrixSparseCSC A,
int colA,
org.ejml.data.DMatrixSparseCSC B,
int colB,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Computes the inner product of two column vectors taken from the input matrices.
|
static double |
elementMax(org.ejml.data.DMatrixSparseCSC A)
Returns the value of the element with the largest value
|
static double |
elementMaxAbs(org.ejml.data.DMatrixSparseCSC A)
Returns the value of the element with the largest abs()
|
static double |
elementMin(org.ejml.data.DMatrixSparseCSC A)
Returns the value of the element with the minimum value
|
static double |
elementMinAbs(org.ejml.data.DMatrixSparseCSC A)
Returns the value of the element with the smallest abs()
|
static void |
elementMult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Performs an element-wise multiplication.
C[i,j] = A[i,j]*B[i,j] All matrices must have the same shape. |
static double |
elementSum(org.ejml.data.DMatrixSparseCSC A)
Sum of all elements
|
static void |
extract(org.ejml.data.DMatrixSparseCSC src,
int srcY0,
int srcY1,
int srcX0,
int srcX1,
org.ejml.data.DMatrixSparseCSC dst,
int dstY0,
int dstX0)
Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.
|
static org.ejml.data.DMatrixSparseCSC |
extractColumn(org.ejml.data.DMatrixSparseCSC A,
int column,
org.ejml.data.DMatrixSparseCSC out)
Extracts a column from A and stores it into out.
|
static void |
extractDiag(org.ejml.data.DMatrixSparseCSC src,
org.ejml.data.DMatrixRMaj dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector.
|
static void |
extractDiag(org.ejml.data.DMatrixSparseCSC src,
org.ejml.data.DMatrixSparseCSC dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector.
|
static org.ejml.data.DMatrixSparseCSC |
extractRows(org.ejml.data.DMatrixSparseCSC A,
int row0,
int row1,
org.ejml.data.DMatrixSparseCSC out)
Creates a submatrix by extracting the specified rows from A.
|
static void |
fill(org.ejml.data.DMatrixSparseCSC A,
double value)
Sets every element in the matrix to the specified value.
|
static org.ejml.data.DMatrixSparseCSC |
identity(int length) |
static org.ejml.data.DMatrixSparseCSC |
identity(int numRows,
int numCols) |
static void |
innerProductLower(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Computes the inner product of A times A and stores the results in B.
|
static boolean |
invert(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj inverse)
Performs a matrix inversion operation that does not modify the original
and stores the results in another matrix.
|
static org.ejml.data.DMatrixRMaj |
maxCols(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output)
Computes the maximums of each column in the input matrix and returns the results in a vector:
bj = max(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
maxRows(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output,
org.ejml.data.IGrowArray gw)
Computes the maximum of each row in the input matrix and returns the results in a vector:
bj = max(i=1:n ; aji) |
static org.ejml.data.DMatrixRMaj |
minCols(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output)
Computes the minimum of each column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
minRows(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output,
org.ejml.data.IGrowArray gw)
Computes the minimum of each row in the input matrix and returns the results in a vector:
bj = min(i=1:n ; aji) |
static void |
mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
Performs matrix multiplication.
|
static void |
mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C) |
static void |
mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Performs matrix multiplication.
|
static void |
multAdd(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + A*B
|
static void |
multAddTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + AT*B
|
static void |
multAddTransAB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + AT*BT
|
static void |
multAddTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + A*BT
|
static void |
multColumns(org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset)
Multiply all elements of column 'i' by value[i].
|
static void |
multRows(double[] diag,
int offset,
org.ejml.data.DMatrixSparseCSC A)
Multiply all elements of row 'i' by value[i].
|
static void |
multRowsCols(double[] diagA,
int offsetA,
org.ejml.data.DMatrixSparseCSC B,
double[] diagC,
int offsetC)
Equivalent to multiplying a matrix B by two diagonal matrices.
|
static void |
multTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
Performs matrix multiplication.
|
static void |
multTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx) |
static void |
multTransAB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
Performs matrix multiplication.
|
static void |
multTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
Performs matrix multiplication.
|
static void |
multTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
Performs matrix multiplication.
|
static int[] |
permutationInverse(int[] original,
int length) |
static void |
permutationInverse(int[] original,
int[] inverse,
int length)
Computes the inverse permutation vector
|
static org.ejml.data.DMatrixSparseCSC |
permutationMatrix(int[] p,
boolean inverse,
int N,
org.ejml.data.DMatrixSparseCSC P)
Converts the permutation vector into a matrix.
|
static void |
permutationVector(org.ejml.data.DMatrixSparseCSC P,
int[] vector)
Converts the permutation matrix into a vector
|
static void |
permute(int[] permRowInv,
org.ejml.data.DMatrixSparseCSC input,
int[] permCol,
org.ejml.data.DMatrixSparseCSC output)
Applies the forward column and inverse row permutation specified by the two vector to the input matrix
and save the results in the output matrix.
|
static void |
permute(int[] perm,
double[] input,
double[] output,
int N)
Permutes a vector.
|
static void |
permuteInv(int[] perm,
double[] input,
double[] output,
int N)
Permutes a vector in the inverse.
|
static void |
permuteRowInv(int[] permInv,
org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixSparseCSC output)
Applies the row permutation specified by the vector to the input matrix and save the results
in the output matrix.
|
static void |
permuteSymmetric(org.ejml.data.DMatrixSparseCSC input,
int[] permInv,
org.ejml.data.DMatrixSparseCSC output,
org.ejml.data.IGrowArray gw)
Applies the permutation to upper triangular symmetric matrices.
|
static void |
removeZeros(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixSparseCSC output,
double tol)
Copies all elements from input into output which are > tol.
|
static void |
removeZeros(org.ejml.data.DMatrixSparseCSC A,
double tol)
Removes all elements from the matrix that are > tol.
|
static void |
scale(double scalar,
org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
B = scalar*A.
|
static void |
setIdentity(org.ejml.data.DMatrixSparseCSC A) |
static boolean |
solve(org.ejml.data.DMatrixSparseCSC a,
org.ejml.data.DMatrixRMaj b,
org.ejml.data.DMatrixRMaj x)
Solves for x in the following equation:
A*x = b |
static boolean |
solve(org.ejml.data.DMatrixSparseCSC a,
org.ejml.data.DMatrixSparseCSC b,
org.ejml.data.DMatrixSparseCSC x)
Solves for x in the following equation:
A*x = b |
static org.ejml.data.DMatrixRMaj |
sumCols(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output)
Computes the sum of each column in the input matrix and returns the results in a vector:
bj = sum(i=1:m ; aij) |
static org.ejml.data.DMatrixRMaj |
sumRows(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixRMaj output)
Computes the sum of each row in the input matrix and returns the results in a vector:
bj = sum(i=1:n ; aji) |
static void |
symmLowerToFull(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.IGrowArray gw)
Given a symmetric matrix, which is represented by a lower triangular matrix, convert it back into
a full symmetric matrix
|
static double |
trace(org.ejml.data.DMatrixSparseCSC A)
This computes the trace of the matrix:
trace = ∑i=1:n { aii } where n = min(numRows,numCols) |
static org.ejml.data.DMatrixSparseCSC |
transpose(org.ejml.data.DMatrixSparseCSC a,
org.ejml.data.DMatrixSparseCSC a_t,
org.ejml.data.IGrowArray gw)
Perform matrix transpose
|
static void |
zero(org.ejml.data.DMatrixSparseCSC A,
int row0,
int row1,
int col0,
int col1)
Zeros an inner rectangle inside the matrix.
|
public static boolean checkIndicesSorted(org.ejml.data.DMatrixSparseCSC A)
public static boolean checkStructure(org.ejml.data.DMatrixSparseCSC A)
public static boolean checkSortedFlag(org.ejml.data.DMatrixSparseCSC A)
public static boolean checkDuplicateElements(org.ejml.data.DMatrixSparseCSC A)
A - Matrix to be tested.public static org.ejml.data.DMatrixSparseCSC transpose(org.ejml.data.DMatrixSparseCSC a,
@Nullable
org.ejml.data.DMatrixSparseCSC a_t,
@Nullable
org.ejml.data.IGrowArray gw)
a - Input matrix. Not modifieda_t - Storage for transpose of 'a'. Must be correct shape. data length might be adjusted.gw - (Optional) Storage for internal workspace. Can be null.public static void mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C)
public static void mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
A - (Input) Matrix. Not modified.B - (Input) Matrix. Not modified.C - (Output) Storage for results. Data length is increased if increased if insufficient.gw - (Optional) Storage for internal workspace. Can be null.gx - (Optional) Storage for internal workspace. Can be null.public static void multTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
public static void multTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
A - (Input) Matrix. Not modified.B - (Input) Matrix. Value not modified but indicies will be sorted if not sorted already.C - (Output) Storage for results. Data length is increased if increased if insufficient.gw - (Optional) Storage for internal workspace. Can be null.gx - (Optional) Storage for internal workspace. Can be null.public static void mult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
A - MatrixB - Dense MatrixC - Dense Matrixpublic static void multAdd(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + A*B
public static void multTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
A - MatrixB - Dense MatrixC - Dense Matrixpublic static void multAddTransA(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + AT*B
public static void multTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
A - MatrixB - Dense MatrixC - Dense Matrixpublic static void multAddTransB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + A*BT
public static void multTransAB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
A - MatrixB - Dense MatrixC - Dense Matrixpublic static void multAddTransAB(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj B,
org.ejml.data.DMatrixRMaj C)
C = C + AT*BT
public static void innerProductLower(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
symmLowerToFull(org.ejml.data.DMatrixSparseCSC, org.ejml.data.DMatrixSparseCSC, org.ejml.data.IGrowArray).
B = AT*A
A - (Input) MatrixB - (Output) Storage for output.gw - (Optional) Workspacegx - (Optional) Workspacepublic static void symmLowerToFull(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
@Nullable
org.ejml.data.IGrowArray gw)
A - (Input) Lower triangular matrixB - (Output) Symmetric matrix.gw - (Optional) Workspace. Can be null.public static void add(double alpha,
org.ejml.data.DMatrixSparseCSC A,
double beta,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
alpha - scalar value multiplied against AA - Matrixbeta - scalar value multiplied against BB - MatrixC - Output matrix.gw - (Optional) Storage for internal workspace. Can be null.gx - (Optional) Storage for internal workspace. Can be null.public static org.ejml.data.DMatrixSparseCSC identity(int length)
public static org.ejml.data.DMatrixSparseCSC identity(int numRows,
int numCols)
public static void setIdentity(org.ejml.data.DMatrixSparseCSC A)
public static void scale(double scalar,
org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
scalar - (Input) Scalar valueA - (Input) Matrix. Not modified.B - (Output) Matrix. Modified.public static void divide(org.ejml.data.DMatrixSparseCSC A,
double scalar,
org.ejml.data.DMatrixSparseCSC B)
scalar - (Input) Scalar valueA - (Input) Matrix. Not modified.B - (Output) Matrix. Modified.public static void divide(double scalar,
org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
A - (Input) Matrix. Not modified.scalar - (Input) Scalar valueB - (Output) Matrix. Modified.public static void changeSign(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B)
A - (Input) Matrix. Not modified.B - (Output) Matrix. Modified.public static double elementMinAbs(org.ejml.data.DMatrixSparseCSC A)
A - (Input) Matrix. Not modified.public static double elementMaxAbs(org.ejml.data.DMatrixSparseCSC A)
A - (Input) Matrix. Not modified.public static double elementMin(org.ejml.data.DMatrixSparseCSC A)
A - (Input) Matrix. Not modified.public static double elementMax(org.ejml.data.DMatrixSparseCSC A)
A - (Input) Matrix. Not modified.public static double elementSum(org.ejml.data.DMatrixSparseCSC A)
A - (Input) Matrix. Not modified.public static void elementMult(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixSparseCSC B,
org.ejml.data.DMatrixSparseCSC C,
@Nullable
org.ejml.data.IGrowArray gw,
@Nullable
org.ejml.data.DGrowArray gx)
A - (Input) Matrix.B - (Input) MatrixC - (Output) Matrix. data array is grown to min(A.nz_length,B.nz_length), resulting a in a large speed boost.gw - (Optional) Storage for internal workspace. Can be null.gx - (Optional) Storage for internal workspace. Can be null.public static void columnMaxAbs(org.ejml.data.DMatrixSparseCSC A,
double[] values)
A - (Input) Matrixvalues - (Output) storage for column max abspublic static void multColumns(org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset)
A - (Input/Output) Matrix. Modified.values - (Input) multiplication factor for each columnoffset - (Input) first index in values to start atpublic static void divideColumns(org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset)
A - (Input/Output) Matrix. Modified.values - (Input) multiplication factor for each columnoffset - (Input) first index in values to start atpublic static void multRowsCols(double[] diagA,
int offsetA,
org.ejml.data.DMatrixSparseCSC B,
double[] diagC,
int offsetC)
diagA - Array of length offsteA + B.numRowsoffsetA - First index in AB - Rectangular matrixdiagC - Array of length indexC + B.numColsoffsetC - First index in Cpublic static void divideRowsCols(double[] diagA,
int offsetA,
org.ejml.data.DMatrixSparseCSC B,
double[] diagC,
int offsetC)
diagA - Array of length offsteA + B.numRowsoffsetA - First index in AB - Rectangular matrixdiagC - Array of length indexC + B.numColsoffsetC - First index in Cpublic static org.ejml.data.DMatrixSparseCSC diag(double... values)
values - values of diagonal elementspublic static org.ejml.data.DMatrixSparseCSC diag(@Nullable
org.ejml.data.DMatrixSparseCSC A,
double[] values,
int offset,
int length)
A - (Optional) Storage for diagonal matrix. If null a new one will be declared.values - First index in the diagonal matirxlength - Length of the diagonal matrixoffset - First index in valuespublic static void extractDiag(org.ejml.data.DMatrixSparseCSC src,
org.ejml.data.DMatrixSparseCSC dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector.
src - Matrix whose diagonal elements are being extracted. Not modified.dst - A vector the results will be written into. Modified.public static void extractDiag(org.ejml.data.DMatrixSparseCSC src,
org.ejml.data.DMatrixRMaj dst)
Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector.
src - Matrix whose diagonal elements are being extracted. Not modified.dst - A vector the results will be written into. Modified.public static org.ejml.data.DMatrixSparseCSC permutationMatrix(int[] p,
boolean inverse,
int N,
org.ejml.data.DMatrixSparseCSC P)
p - (Input) Permutation vectorinverse - (Input) If it is the inverse. B[i,:] = A[p[i],:)P - (Output) Permutation matrixpublic static void permutationVector(org.ejml.data.DMatrixSparseCSC P,
int[] vector)
P - (Input) Permutation matrixvector - (Output) Permutation vectorpublic static void permutationInverse(int[] original,
int[] inverse,
int length)
original - Original permutation vectorinverse - It's inversepublic static int[] permutationInverse(int[] original,
int length)
public static void permuteRowInv(int[] permInv,
org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixSparseCSC output)
permInv - (Input) Inverse permutation vector. Specifies new order of the rows.input - (Input) Matrix which is to be permutedoutput - (Output) Matrix which has the permutation stored in it. Is reshaped.public static void permute(@Nullable
int[] permRowInv,
org.ejml.data.DMatrixSparseCSC input,
@Nullable
int[] permCol,
org.ejml.data.DMatrixSparseCSC output)
permRowInv - (Input) Inverse row permutation vector. Null is the same as passing in identity.input - (Input) Matrix which is to be permutedpermCol - (Input) Column permutation vector. Null is the same as passing in identity.output - (Output) Matrix which has the permutation stored in it. Is reshaped.public static void permute(int[] perm,
double[] input,
double[] output,
int N)
perm - (Input) permutation vectorinput - (Input) Vector which is to be permutedoutput - (Output) Where the permuted vector is stored.N - Number of elements in the vector.public static void permuteInv(int[] perm,
double[] input,
double[] output,
int N)
perm - (Input) permutation vectorinput - (Input) Vector which is to be permutedoutput - (Output) Where the permuted vector is stored.N - Number of elements in the vector.public static void permuteSymmetric(org.ejml.data.DMatrixSparseCSC input,
int[] permInv,
org.ejml.data.DMatrixSparseCSC output,
@Nullable
org.ejml.data.IGrowArray gw)
See page cs_symperm() on Page 22 of "Direct Methods for Sparse Linear Systems"
input - (Input) Upper triangular symmetric matrix which is to be permuted.
Entries below the diagonal are ignored.permInv - (Input) Inverse permutation vector. Specifies new order of the rows and columns.output - (Output) Upper triangular symmetric matrix which has the permutation stored in it. Reshaped.gw - (Optional) Storage for internal workspace. Can be null.public static org.ejml.data.DMatrixSparseCSC concatRows(org.ejml.data.DMatrixSparseCSC top,
org.ejml.data.DMatrixSparseCSC bottom,
@Nullable
org.ejml.data.DMatrixSparseCSC out)
top - Matrix on the topbottom - Matrix on the bototmout - (Output) (Optional) Storage for combined matrix. Resized.public static org.ejml.data.DMatrixSparseCSC concatColumns(org.ejml.data.DMatrixSparseCSC left,
org.ejml.data.DMatrixSparseCSC right,
@Nullable
org.ejml.data.DMatrixSparseCSC out)
left - Matrix on the leftright - Matrix on the rightout - (Output) (Optional) Storage for combined matrix. Resized.public static org.ejml.data.DMatrixSparseCSC extractColumn(org.ejml.data.DMatrixSparseCSC A,
int column,
@Nullable
org.ejml.data.DMatrixSparseCSC out)
A - (Input) Source matrix. not modified.column - The column in Aout - (Output, Optional) Storage for column vectorpublic static org.ejml.data.DMatrixSparseCSC extractRows(org.ejml.data.DMatrixSparseCSC A,
int row0,
int row1,
org.ejml.data.DMatrixSparseCSC out)
A - (Input) matrixrow0 - First row. Inclusiverow1 - Last row+1.out - (Output, Option) Storage for output matrixpublic static void extract(org.ejml.data.DMatrixSparseCSC src,
int srcY0,
int srcY1,
int srcX0,
int srcX1,
org.ejml.data.DMatrixSparseCSC dst,
int dstY0,
int dstX0)
Extracts a submatrix from 'src' and inserts it in a submatrix in 'dst'.
si-y0 , j-x0 = oij for all y0 ≤ i < y1 and x0 ≤ j < x1
where 'sij' is an element in the submatrix and 'oij' is an element in the
original matrix.
WARNING: This is a very slow operation for sparse matrices. The current implementation is simple but involves excessive memory copying.
src - The original matrix which is to be copied. Not modified.srcX0 - Start column.srcX1 - Stop column+1.srcY0 - Start row.srcY1 - Stop row+1.dst - Where the submatrix are stored. Modified.dstY0 - Start row in dst.dstX0 - start column in dst.public static void fill(org.ejml.data.DMatrixSparseCSC A,
double value)
Sets every element in the matrix to the specified value. This can require a very large amount of
memory and might exceed the maximum array size
Aij = value
A - A matrix whose elements are about to be set. Modified.value - The value each element will have.public static org.ejml.data.DMatrixRMaj sumCols(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output)
Computes the sum of each column in the input matrix and returns the results in a vector:
bj = sum(i=1:m ; aij)
input - Input matrixoutput - Optional storage for output. Reshaped into a row vector. Modified.public static org.ejml.data.DMatrixRMaj minCols(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output)
Computes the minimum of each column in the input matrix and returns the results in a vector:
bj = min(i=1:m ; aij)
input - Input matrixoutput - Optional storage for output. Reshaped into a row vector. Modified.public static org.ejml.data.DMatrixRMaj maxCols(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output)
Computes the maximums of each column in the input matrix and returns the results in a vector:
bj = max(i=1:m ; aij)
input - Input matrixoutput - Optional storage for output. Reshaped into a row vector. Modified.public static org.ejml.data.DMatrixRMaj sumRows(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output)
Computes the sum of each row in the input matrix and returns the results in a vector:
bj = sum(i=1:n ; aji)
input - Input matrixoutput - Optional storage for output. Reshaped into a column vector. Modified.public static org.ejml.data.DMatrixRMaj minRows(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output,
@Nullable
org.ejml.data.IGrowArray gw)
Computes the minimum of each row in the input matrix and returns the results in a vector:
bj = min(i=1:n ; aji)
input - Input matrixoutput - Optional storage for output. Reshaped into a column vector. Modified.gw - work spacepublic static org.ejml.data.DMatrixRMaj maxRows(org.ejml.data.DMatrixSparseCSC input,
@Nullable
org.ejml.data.DMatrixRMaj output,
@Nullable
org.ejml.data.IGrowArray gw)
Computes the maximum of each row in the input matrix and returns the results in a vector:
bj = max(i=1:n ; aji)
input - Input matrixoutput - Optional storage for output. Reshaped into a column vector. Modified.gw - work spacepublic static void zero(org.ejml.data.DMatrixSparseCSC A,
int row0,
int row1,
int col0,
int col1)
A - Matrix that is to be modified.row0 - Start row.row1 - Stop row+1.col0 - Start column.col1 - Stop column+1.public static double dotInnerColumns(org.ejml.data.DMatrixSparseCSC A,
int colA,
org.ejml.data.DMatrixSparseCSC B,
int colB,
org.ejml.data.IGrowArray gw,
org.ejml.data.DGrowArray gx)
dot = A(:,colA)'*B(:,colB)
A - MatrixcolA - Column in AB - MatrixcolB - Column in Bpublic static boolean solve(org.ejml.data.DMatrixSparseCSC a,
org.ejml.data.DMatrixRMaj b,
org.ejml.data.DMatrixRMaj x)
Solves for x in the following equation:
A*x = b
If the system could not be solved then false is returned. If it returns true that just means the algorithm finished operating, but the results could still be bad because 'A' is singular or nearly singular.
If repeat calls to solve are being made then one should consider using LinearSolverFactory_DSCC
instead.
It is ok for 'b' and 'x' to be the same matrix.
a - (Input) A matrix that is m by n. Not modified.b - (Input) A matrix that is n by k. Not modified.x - (Output) A matrix that is m by k. Modified.public static boolean solve(org.ejml.data.DMatrixSparseCSC a,
org.ejml.data.DMatrixSparseCSC b,
org.ejml.data.DMatrixSparseCSC x)
Solves for x in the following equation:
A*x = b
If the system could not be solved then false is returned. If it returns true that just means the algorithm finished operating, but the results could still be bad because 'A' is singular or nearly singular.
If repeat calls to solve are being made then one should consider using LinearSolverFactory_DSCC
instead.
It is ok for 'b' and 'x' to be the same matrix.
a - (Input) A matrix that is m by n. Not modified.b - (Input) A matrix that is n by k. Not modified.x - (Output) A matrix that is m by k. Modified.public static boolean invert(org.ejml.data.DMatrixSparseCSC A,
org.ejml.data.DMatrixRMaj inverse)
Performs a matrix inversion operation that does not modify the original
and stores the results in another matrix. The two matrices must have the
same dimension.
B = A-1
If the algorithm could not invert the matrix then false is returned. If it returns true that just means the algorithm finished. The results could still be bad because the matrix is singular or nearly singular.
For medium to large matrices there might be a slight performance boost to using
LinearSolverFactory_DSCC instead.
A - (Input) The matrix that is to be inverted. Not modified.inverse - (Output) Where the inverse matrix is stored. Modified.public static double det(org.ejml.data.DMatrixSparseCSC A)
LUDecomposition_F64 directly (or any
similar algorithm) can be more efficient.A - The matrix whose determinant is to be computed. Not modified.public static void removeZeros(org.ejml.data.DMatrixSparseCSC input,
org.ejml.data.DMatrixSparseCSC output,
double tol)
input - (Input) input matrix. Not modified.output - (Output) Output matrix. Modified and shaped to match input.tol - Tolerance for defining zeropublic static void removeZeros(org.ejml.data.DMatrixSparseCSC A,
double tol)
A - (Input/Output) input matrix. Modified.tol - Tolerance for defining zeropublic static void multRows(double[] diag,
int offset,
org.ejml.data.DMatrixSparseCSC A)
diag - (Input) multiplication factorsoffset - (Input) First index in valuesA - (Input/Output) Matrix. Modified.public static void divideRows(double[] diag,
int offset,
org.ejml.data.DMatrixSparseCSC A)
diag - (Input) division factorsoffset - (Input) First index in valuesA - (Input/Output) Matrix. Modified.public static double trace(org.ejml.data.DMatrixSparseCSC A)
This computes the trace of the matrix:
trace = ∑i=1:n { aii }
where n = min(numRows,numCols)
A - (Input) Matrix. Not modified.