Package com.macrofocus.high_d.mds.tsne
Class AbstractMatrixOperations
- java.lang.Object
-
- com.macrofocus.high_d.mds.tsne.AbstractMatrixOperations
-
- All Implemented Interfaces:
MatrixOperations
- Direct Known Subclasses:
DefaultMatrixOperations
public abstract class AbstractMatrixOperations extends java.lang.Object implements MatrixOperations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.macrofocus.high_d.mds.tsne.MatrixOperations
MatrixOperations.MatrixOp
-
-
Constructor Summary
Constructors Constructor Description AbstractMatrixOperations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]
abs(boolean[][] booleans)
double[][]
addColumnVector(double[][] matrix, double[][] colvector)
double[][]
addRowVector(double[][] matrix, double[][] rowvector)
void
assignAllLessThan(double[][] matrix, double lessthan, double assign)
All values in matrix that is less thanlessthan
is assigned the valueassign
void
assignAtIndex(double[][] num, int[] range, int[] range1, double value)
void
assignValuesToRow(double[][] matrix, int row, int[] indicies, double[] values)
boolean[][]
biggerThan(double[][] matrix, double value)
Returns a new matrix of booleans where true is set if the value in the matrix is bigger than valueint[]
concatenate(int[] v1, int[] v2)
double[][]
diag(double[][] ds)
boolean[][]
equal(boolean[][] matrix1, boolean[][] matrix2)
Returns a new matrix of booleans where true is set if the values to the two matrices are the same at that indexdouble[][]
exp(double[][] v1)
Destructively sets the values in matrix to its exponentiated valuedouble[][]
fillMatrix(int rows, int cols, double fillvalue)
double[][]
getValuesFromRow(double[][] matrix, int row, int[] indicies)
double[][]
maximum(double[][] matrix, double maxval)
Return a new matrix with the max value of either the value in the matrix or maxval otherwisedouble[][]
mean(double[][] matrix, int axis)
boolean[][]
negate(boolean[][] booleans)
Returns new matrix with booleans which are the negations of the inputdouble[][]
plus(double[][] m1, double[][] m2)
int[]
range(int n)
int[]
range(int a, int b)
double[][]
rnorm(int m, int n)
Returns new 2D matrix with normal random values with mean 0 and std.double[][]
scalarDivide(double[][] numerator, double denom)
double[][]
scalarInverse(double[][] m1)
Returns scalar inverse of matrixdouble[][]
scalarMult(double[][] m1, double mul)
double[][]
scalarPlus(double[][] m1, double m2)
double[][]
scalarPow(double[][] matrix, double power)
double[][]
square(double[][] matrix)
Returns a new matrix with the values of matrix squareddouble
sum(double[][] matrix)
Returns sum of all values in the matrixdouble[][]
sum(double[][] matrix, int axis)
double[][]
tile(double[][] matrix, int rowtimes, int coltimes)
double[][]
times(double[][] a, double[][] b)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.macrofocus.high_d.mds.tsne.MatrixOperations
dnrom, minus, scalarMultiply, transpose
-
-
-
-
Method Detail
-
mean
public double[][] mean(double[][] matrix, int axis)
- Specified by:
mean
in interfaceMatrixOperations
-
exp
public double[][] exp(double[][] v1)
Description copied from interface:MatrixOperations
Destructively sets the values in matrix to its exponentiated value- Specified by:
exp
in interfaceMatrixOperations
- Returns:
- same matrix with values exponentiated
-
scalarInverse
public double[][] scalarInverse(double[][] m1)
Description copied from interface:MatrixOperations
Returns scalar inverse of matrix- Specified by:
scalarInverse
in interfaceMatrixOperations
-
rnorm
public double[][] rnorm(int m, int n)
Description copied from interface:MatrixOperations
Returns new 2D matrix with normal random values with mean 0 and std. dev 1- Specified by:
rnorm
in interfaceMatrixOperations
-
equal
public boolean[][] equal(boolean[][] matrix1, boolean[][] matrix2)
Description copied from interface:MatrixOperations
Returns a new matrix of booleans where true is set if the values to the two matrices are the same at that index- Specified by:
equal
in interfaceMatrixOperations
- Returns:
- new matrix with booelans with values matrix1[i,j] == matrix2[i,j]
-
biggerThan
public boolean[][] biggerThan(double[][] matrix, double value)
Description copied from interface:MatrixOperations
Returns a new matrix of booleans where true is set if the value in the matrix is bigger than value- Specified by:
biggerThan
in interfaceMatrixOperations
- Returns:
- new matrix with booelans with values matrix1[i,j] == matrix2[i,j]
-
negate
public boolean[][] negate(boolean[][] booleans)
Description copied from interface:MatrixOperations
Returns new matrix with booleans which are the negations of the input- Specified by:
negate
in interfaceMatrixOperations
-
abs
public double[][] abs(boolean[][] booleans)
- Specified by:
abs
in interfaceMatrixOperations
-
sum
public double[][] sum(double[][] matrix, int axis)
- Specified by:
sum
in interfaceMatrixOperations
-
sum
public double sum(double[][] matrix)
Description copied from interface:MatrixOperations
Returns sum of all values in the matrix- Specified by:
sum
in interfaceMatrixOperations
-
maximum
public double[][] maximum(double[][] matrix, double maxval)
Description copied from interface:MatrixOperations
Return a new matrix with the max value of either the value in the matrix or maxval otherwise- Specified by:
maximum
in interfaceMatrixOperations
-
assignAllLessThan
public void assignAllLessThan(double[][] matrix, double lessthan, double assign)
Description copied from interface:MatrixOperations
All values in matrix that is less thanlessthan
is assigned the valueassign
- Specified by:
assignAllLessThan
in interfaceMatrixOperations
-
square
public double[][] square(double[][] matrix)
Description copied from interface:MatrixOperations
Returns a new matrix with the values of matrix squared- Specified by:
square
in interfaceMatrixOperations
-
scalarPow
public double[][] scalarPow(double[][] matrix, double power)
- Specified by:
scalarPow
in interfaceMatrixOperations
-
addColumnVector
public double[][] addColumnVector(double[][] matrix, double[][] colvector)
- Specified by:
addColumnVector
in interfaceMatrixOperations
-
addRowVector
public double[][] addRowVector(double[][] matrix, double[][] rowvector)
- Specified by:
addRowVector
in interfaceMatrixOperations
-
tile
public double[][] tile(double[][] matrix, int rowtimes, int coltimes)
- Specified by:
tile
in interfaceMatrixOperations
-
range
public int[] range(int n)
- Specified by:
range
in interfaceMatrixOperations
-
range
public int[] range(int a, int b)
- Specified by:
range
in interfaceMatrixOperations
-
concatenate
public int[] concatenate(int[] v1, int[] v2)
- Specified by:
concatenate
in interfaceMatrixOperations
-
assignAtIndex
public void assignAtIndex(double[][] num, int[] range, int[] range1, double value)
- Specified by:
assignAtIndex
in interfaceMatrixOperations
-
getValuesFromRow
public double[][] getValuesFromRow(double[][] matrix, int row, int[] indicies)
- Specified by:
getValuesFromRow
in interfaceMatrixOperations
-
assignValuesToRow
public void assignValuesToRow(double[][] matrix, int row, int[] indicies, double[] values)
- Specified by:
assignValuesToRow
in interfaceMatrixOperations
-
fillMatrix
public double[][] fillMatrix(int rows, int cols, double fillvalue)
- Specified by:
fillMatrix
in interfaceMatrixOperations
-
plus
public double[][] plus(double[][] m1, double[][] m2)
- Specified by:
plus
in interfaceMatrixOperations
-
scalarPlus
public double[][] scalarPlus(double[][] m1, double m2)
- Specified by:
scalarPlus
in interfaceMatrixOperations
-
scalarDivide
public double[][] scalarDivide(double[][] numerator, double denom)
- Specified by:
scalarDivide
in interfaceMatrixOperations
-
scalarMult
public double[][] scalarMult(double[][] m1, double mul)
- Specified by:
scalarMult
in interfaceMatrixOperations
-
times
public double[][] times(double[][] a, double[][] b)
- Specified by:
times
in interfaceMatrixOperations
-
diag
public double[][] diag(double[][] ds)
- Specified by:
diag
in interfaceMatrixOperations
-
-