Interface Matrix<E>
- Type Parameters:
- E-
- All Known Implementing Classes:
- BaseMatrix,- MutableMatrix,- SparseMatrix
A representation of a matrix taking entries of type E.
 
 Matrices are by default immutable, but calling the mutable() returns an instance of a
 MutableMatrix which may be edited.
- 
Method SummaryModifier and TypeMethodDescriptioncollapseColumns(E init, java.util.function.BinaryOperator<E> op) collapseRows(E init, java.util.function.BinaryOperator<E> op) static <F> Matrix<F>columns()static <E> Matrix<E>Create copy of a matrix.static <E> Matrix<E>diagonal(int n, java.util.function.IntFunction<E> populator, E zero) static <T> java.util.function.BinaryOperator<Matrix<T>>entrywiseOperator(java.util.function.BinaryOperator<T> op) booleanReturns a new larger matrix of size m x n which has this matrix in the top left corner and pads the rest using the given padding value.extendWith(int dm, int dn, E padding) static <E> Matrix<E>static <E> Matrix<E>eye(int n, E one, E zero) static <E> Matrix<E>fromBlocks(Matrix<Matrix<E>> blocks) get(int i, int j) default EgetColumn(int j) intgetRow(int i) intgetWidth()booleanisSquare()static <E> Matrix<E>lazy(int m, int n, IntBinaryFunction<E> populator) Generate aMatrix<E>where each element is created using the given populator when it is needed.<F> Matrix<F>minor(int i, int j) mutable()Returns a mutable copy of this matrix.static <E> Matrix<E>of(int m, int n, IntBinaryFunction<E> populator) Create a new matrix with the given height, width and populate it using the given function.static <E> Matrix<E>of(int m, int n, IntBinaryFunction<E> populator, boolean populateSequentially) Create a new matrix with the given height, width and populate it using the given function.static <E> Matrix<E>of(int m, int n, E defaultValue) static <E> Matrix<E>of(int m, E... entries) Convenience function to quickly define (small) matrices.static <E> Matrix<E>Create a new matrix with the given height and populate it using the given row populator.static <E> Matrix<E>of(E[]... rows) static <E> Matrix<E>static <F> Matrix<F>rows()default java.util.stream.Stream<E>stream()submatrix(int[] rows, int[] columns) Returns a new matrix with the given rows and columns from this matrix.submatrix(int r0, int r1, int c0, int c1) Returns a new matrix of size (r1-r0) x (c1-c0) with rows r0, ..., r1-1 and columns c0, ..., c1-1 from this matrix.view()Returns a view of the given matrix.Methods inherited from interface java.util.function.BiFunctionandThen, apply
- 
Method Details- 
lazyGenerate aMatrix<E>where each element is created using the given populator when it is needed.- Type Parameters:
- E- The type of the entries.
- Parameters:
- m- The height of the matrix
- n- The width of the matrix
- populator- The populator function where- populator.apply(i, j)generates the (i,j)'th entry.
- Returns:
- A Matrix<E>where each element is created using the given populator when it is needed.
 
- 
copyCreate copy of a matrix. Note that the entries will be the same as in the original, and is hence not cloned.
- 
ofCreate a new matrix with the given height, width and populate it using the given function. The entries are created immediately in parallel.
- 
ofCreate a new matrix with the given height, width and populate it using the given function. The entries are created immediately sequentially.
- 
ofCreate a new matrix with the given height and populate it using the given row populator. The rows are created immediately in parallel.
- 
of
- 
of
- 
ofConvenience function to quickly define (small) matrices. The m is the number of rows and the remaining are the entries which should be divisible by the number of rows.
- 
of
- 
eye
- 
eye
- 
fromBlocks
- 
entrywiseOperatorstatic <T> java.util.function.BinaryOperator<Matrix<T>> entrywiseOperator(java.util.function.BinaryOperator<T> op) 
- 
row
- 
column
- 
diagonal
- 
getColumn
- 
getRow
- 
get
- 
get
- 
getHeightint getHeight()
- 
getWidthint getWidth()
- 
minor
- 
transpose
- 
map
- 
rows
- 
columns
- 
equals
- 
isSquareboolean isSquare()
- 
extendToReturns a new larger matrix of size m x n which has this matrix in the top left corner and pads the rest using the given padding value.
- 
extendWith
- 
submatrixReturns a new matrix with the given rows and columns from this matrix. The given arrays are assumed to be sorted.
- 
submatrixReturns a new matrix of size (r1-r0) x (c1-c0) with rows r0, ..., r1-1 and columns c0, ..., c1-1 from this matrix.
- 
viewReturns a view of the given matrix. This does not store any values but instead maps operations to this matrix.
- 
mutableMutableMatrix<E> mutable()Returns a mutable copy of this matrix.
- 
collapseRows
- 
collapseColumns
- 
stream
- 
toString
 
-