public class CFMatrixUtils extends Object
Matrix
.Constructor and Description |
---|
CFMatrixUtils() |
Modifier and Type | Method and Description |
---|---|
static gov.sandia.cognition.math.matrix.Matrix |
abs(gov.sandia.cognition.math.matrix.Matrix mat)
Create a new matrix with the absolute values of the input matrix.
|
static double |
absSum(gov.sandia.cognition.math.matrix.Matrix mat)
Compute the absolute sum of values in the matrix
|
static double |
absSumSparse(gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix mat) |
static double |
absSumSparse(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix mat) |
static Jama.Matrix |
asJama(gov.sandia.cognition.math.matrix.Matrix laplacian) |
static gov.sandia.cognition.math.matrix.Matrix |
asMat(com.jmatio.types.MLArray mlArray)
Convert a matlab
MLArray to a Matrix |
static gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix |
asSparseColumn(gov.sandia.cognition.math.matrix.Matrix a) |
static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix |
asSparseRow(gov.sandia.cognition.math.matrix.Matrix a)
Convert a
Matrix to a SparseRowMatrix |
static gov.sandia.cognition.math.matrix.Vector |
colMean(gov.sandia.cognition.math.matrix.Matrix vt) |
static double |
colSparcity(gov.sandia.cognition.math.matrix.Matrix mat)
Compute the proportion of completely zero columns to columns with
non-zero values
|
static boolean |
containsInfinity(gov.sandia.cognition.math.matrix.Matrix mat) |
static boolean |
containsNaN(gov.sandia.cognition.math.matrix.Matrix mat) |
static boolean |
containsNaN(gov.sandia.cognition.math.matrix.Vector vec) |
static gov.sandia.cognition.math.matrix.Vector |
diag(gov.sandia.cognition.math.matrix.Matrix mat)
Extract the diagonal elements as a vector
|
static gov.sandia.cognition.math.matrix.Matrix |
fastdot(gov.sandia.cognition.math.matrix.Matrix a,
gov.sandia.cognition.math.matrix.Matrix b) |
static gov.sandia.cognition.math.matrix.Matrix |
fastminus(gov.sandia.cognition.math.matrix.Matrix A,
gov.sandia.cognition.math.matrix.Matrix B) |
static gov.sandia.cognition.math.matrix.Matrix |
fastminusEquals(gov.sandia.cognition.math.matrix.Matrix A,
gov.sandia.cognition.math.matrix.Matrix B) |
static void |
fastsetcol(gov.sandia.cognition.math.matrix.Matrix ret,
int c,
gov.sandia.cognition.math.matrix.Vector col) |
static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix |
fastsparsedot(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix a,
gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix b) |
static gov.sandia.cognition.math.matrix.Matrix |
fastsparseminusEquals(gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix A,
gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix B) |
static gov.sandia.cognition.math.matrix.Matrix |
fastsparseminusEquals(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix A,
gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix B) |
static double[] |
getData(gov.sandia.cognition.math.matrix.Matrix w)
Get the data array backing this matrix (in column-major format)
|
static double |
max(gov.sandia.cognition.math.matrix.Matrix u)
Get the maximum element value
|
static double |
max(gov.sandia.cognition.math.matrix.Vector column)
Get the maximum element value
|
static double |
min(gov.sandia.cognition.math.matrix.Matrix u)
Get the minimum element value
|
static double |
min(gov.sandia.cognition.math.matrix.Vector column)
Get the minimum element value
|
static void |
minusEqualsCol(gov.sandia.cognition.math.matrix.Matrix A,
gov.sandia.cognition.math.matrix.Vector col) |
static void |
minusEqualsRow(gov.sandia.cognition.math.matrix.Matrix A,
gov.sandia.cognition.math.matrix.Vector row) |
static gov.sandia.cognition.math.matrix.Matrix |
plusInplace(gov.sandia.cognition.math.matrix.Matrix mat,
double etat)
Add a constant to the matrix, returning the input matrix
|
static <T extends gov.sandia.cognition.math.matrix.Matrix> |
powInplace(T degree,
double d)
Bring each element to the power d
|
static <T extends gov.sandia.cognition.math.matrix.Vector> |
powInplace(T degree,
double d)
Bring each element to the power d
|
static gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix |
randomSparseCol(int rows,
int cols,
double min,
double max,
double density,
Random random)
Create a random
SparseColumnMatrix |
static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix |
randomSparseRow(int rows,
int cols,
double min,
double max,
double density,
Random random)
Create a random
SparseRowMatrix |
static gov.sandia.cognition.math.matrix.Vector |
rowMean(gov.sandia.cognition.math.matrix.Matrix vt) |
static double |
rowSparsity(gov.sandia.cognition.math.matrix.Matrix mat)
Compute the proportion of completely zero rows to rows with non-zero
values
|
static double |
sparsity(gov.sandia.cognition.math.matrix.Matrix mat)
Compute the sparsity
|
static double |
sum(gov.sandia.cognition.math.matrix.Matrix A)
Sum the matrix entries
|
static gov.sandia.cognition.math.matrix.Matrix |
timesInplace(gov.sandia.cognition.math.matrix.Matrix mat,
double etat)
Multiply a matrix by a constant, storing the results in the input matrix.
|
static com.jmatio.types.MLArray |
toMLArray(String name,
gov.sandia.cognition.math.matrix.Matrix mat)
Convert a matlab
MLArray to a Matrix |
static gov.sandia.cognition.math.matrix.Matrix |
vstack(gov.sandia.cognition.math.matrix.Matrix... matricies)
Stack matrices vertically
|
static gov.sandia.cognition.math.matrix.Matrix |
vstack(gov.sandia.cognition.math.matrix.MatrixFactory<? extends gov.sandia.cognition.math.matrix.Matrix> matrixFactory,
gov.sandia.cognition.math.matrix.Matrix... matricies)
Stack matrices vertically
|
public CFMatrixUtils()
public static gov.sandia.cognition.math.matrix.Matrix abs(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- input matrixpublic static double absSum(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- the matrixpublic static double absSumSparse(gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix mat)
mat
- SparseColumnMatrix
public static double absSumSparse(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix mat)
mat
- SparseRowMatrix
public static gov.sandia.cognition.math.matrix.Matrix timesInplace(gov.sandia.cognition.math.matrix.Matrix mat, double etat)
mat
- the matrixetat
- the constantpublic static gov.sandia.cognition.math.matrix.Matrix asMat(com.jmatio.types.MLArray mlArray)
MLArray
to a Matrix
mlArray
- the matrlab matrixpublic static com.jmatio.types.MLArray toMLArray(String name, gov.sandia.cognition.math.matrix.Matrix mat)
MLArray
to a Matrix
name
- mat
- public static double rowSparsity(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- the matrixpublic static double colSparcity(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- the matrixpublic static gov.sandia.cognition.math.matrix.Matrix plusInplace(gov.sandia.cognition.math.matrix.Matrix mat, double etat)
mat
- the matrixetat
- the constantpublic static gov.sandia.cognition.math.matrix.Vector diag(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- the matrix to extract frompublic static gov.sandia.cognition.math.matrix.Matrix vstack(gov.sandia.cognition.math.matrix.MatrixFactory<? extends gov.sandia.cognition.math.matrix.Matrix> matrixFactory, gov.sandia.cognition.math.matrix.Matrix... matricies)
matrixFactory
- factory to create output matrixmatricies
- matrices to stackpublic static gov.sandia.cognition.math.matrix.Matrix vstack(gov.sandia.cognition.math.matrix.Matrix... matricies)
matricies
- matrices to stackpublic static double[] getData(gov.sandia.cognition.math.matrix.Matrix w)
w
- the matrixpublic static double min(gov.sandia.cognition.math.matrix.Matrix u)
u
- the matrixpublic static double max(gov.sandia.cognition.math.matrix.Matrix u)
u
- the matrixpublic static double min(gov.sandia.cognition.math.matrix.Vector column)
column
- the vectorpublic static double max(gov.sandia.cognition.math.matrix.Vector column)
column
- the vectorpublic static double sparsity(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- the matrixpublic static <T extends gov.sandia.cognition.math.matrix.Matrix> T powInplace(T degree, double d)
degree
- d
- public static <T extends gov.sandia.cognition.math.matrix.Vector> T powInplace(T degree, double d)
degree
- d
- public static Jama.Matrix asJama(gov.sandia.cognition.math.matrix.Matrix laplacian)
laplacian
- public static gov.sandia.cognition.math.matrix.Vector rowMean(gov.sandia.cognition.math.matrix.Matrix vt)
vt
- public static gov.sandia.cognition.math.matrix.Vector colMean(gov.sandia.cognition.math.matrix.Matrix vt)
vt
- public static void minusEqualsCol(gov.sandia.cognition.math.matrix.Matrix A, gov.sandia.cognition.math.matrix.Vector col)
A
- col
- public static void minusEqualsRow(gov.sandia.cognition.math.matrix.Matrix A, gov.sandia.cognition.math.matrix.Vector row)
A
- row
- public static gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix randomSparseCol(int rows, int cols, double min, double max, double density, Random random)
SparseColumnMatrix
rows
- number of rowscols
- number of columnsmin
- the minimum valuemax
- the maximum valuedensity
- the matrix densityrandom
- the RNGpublic static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix randomSparseRow(int rows, int cols, double min, double max, double density, Random random)
SparseRowMatrix
rows
- number of rowscols
- number of columnsmin
- the minimum valuemax
- the maximum valuedensity
- the matrix densityrandom
- the RNGpublic static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix fastsparsedot(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix a, gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix b)
a
- b
- public static gov.sandia.cognition.math.matrix.Matrix fastdot(gov.sandia.cognition.math.matrix.Matrix a, gov.sandia.cognition.math.matrix.Matrix b)
a
- b
- public static gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix asSparseColumn(gov.sandia.cognition.math.matrix.Matrix a)
a
- SparseColumnMatrix
public static gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix asSparseRow(gov.sandia.cognition.math.matrix.Matrix a)
Matrix
to a SparseRowMatrix
a
- SparseRowMatrix
public static void fastsetcol(gov.sandia.cognition.math.matrix.Matrix ret, int c, gov.sandia.cognition.math.matrix.Vector col)
ret
- c
- col
- public static gov.sandia.cognition.math.matrix.Matrix fastminusEquals(gov.sandia.cognition.math.matrix.Matrix A, gov.sandia.cognition.math.matrix.Matrix B)
A
- B
- fastsparseminusEquals(SparseColumnMatrix, SparseColumnMatrix)
if possiblepublic static gov.sandia.cognition.math.matrix.Matrix fastminus(gov.sandia.cognition.math.matrix.Matrix A, gov.sandia.cognition.math.matrix.Matrix B)
A
- B
- fastminusEquals(Matrix, Matrix)
if
possiblepublic static gov.sandia.cognition.math.matrix.Matrix fastsparseminusEquals(gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix A, gov.sandia.cognition.math.matrix.mtj.SparseColumnMatrix B)
A
- B
- public static gov.sandia.cognition.math.matrix.Matrix fastsparseminusEquals(gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix A, gov.sandia.cognition.math.matrix.mtj.SparseRowMatrix B)
A
- B
- public static boolean containsNaN(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- Double.isNaN()
public static boolean containsNaN(gov.sandia.cognition.math.matrix.Vector vec)
vec
- Double.isNaN()
public static boolean containsInfinity(gov.sandia.cognition.math.matrix.Matrix mat)
mat
- Double.isInfinite()
public static double sum(gov.sandia.cognition.math.matrix.Matrix A)
A
-