Package dk.alexandra.fresco.stat.utils
Class MatrixUtils
Object
MatrixUtils
public class MatrixUtils extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MatrixUtils.MatrixPopulator<E>
-
Constructor Summary
Constructors Constructor Description MatrixUtils()
-
Method Summary
Modifier and Type Method Description static <E> Matrix<E>
buildMatrix(int h, int w, MatrixUtils.MatrixPopulator<E> populator)
Create a new matrix with the given height and width and populate it use the populator.static <E, F> Matrix<E>
map(Matrix<F> matrix, Function<F,E> function)
Map a matrix to another matrix of the same size using the given functionstatic <E> Matrix<E>
subMatrix(Matrix<E> matrix, int i0, int i1, int j0, int j1)
Create a new matrix from the given one with rows and columns taken from certain intervals.static <E> Matrix<E>
transpose(Matrix<E> a)
Return a new matrix equal to the transpose of the given matrix
-
Constructor Details
-
MatrixUtils
public MatrixUtils()
-
-
Method Details
-
buildMatrix
Create a new matrix with the given height and width and populate it use the populator. -
map
Map a matrix to another matrix of the same size using the given function -
transpose
public static <E> Matrix<E> transpose(Matrix<E> a)Return a new matrix equal to the transpose of the given matrix -
subMatrix
public static <E> Matrix<E> subMatrix(Matrix<E> matrix, int i0, int i1, int j0, int j1)Create a new matrix from the given one with rows and columns taken from certain intervals.- Type Parameters:
E
-- Parameters:
matrix
- The base matrix.i0
- The lower bound (inclusive) for the rows to include.i1
- The upper bound (exclusive) for the rows to include.j0
- The lower bound (inclusive) for the columns to include.j1
- The upper bound (exclusive) for the columns to include.- Returns:
- A new matrix from the given one with rows and columns taken from certain intervals
-