public final class Matrix<T> extends AbstractMatrix<T[],java.util.List<T>,Stream<T>,Stream<Stream<T>>,Matrix<T>>
cols, count, rows
Modifier and Type | Method and Description |
---|---|
Stream<Pair.IntPair> |
adjacent4Points(int i,
int j)
Returns the four adjacencies with order: up, right, down, left.
|
Stream<Pair.IntPair> |
adjacent8Points(int i,
int j)
Returns the eight adjacencies with order: left-up, up, right-up, right, right-down, down, left-down, left.
|
T[][] |
array() |
T[] |
column(int columnIndex) |
Matrix<T> |
copy() |
Matrix<T> |
copy(int fromRowIndex,
int toRowIndex) |
Matrix<T> |
copy(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex) |
static <T> Matrix<T> |
diagonal(T[] leftUp2RighDownDiagonal,
T[] rightUp2LeftDownDiagonal) |
static <T> Matrix<T> |
diagonalLU2RD(T[] leftUp2RighDownDiagonal) |
static <T> Matrix<T> |
diagonalRU2LD(T[] rightUp2LeftDownDiagonal) |
NullabLe<T> |
downOf(int i,
int j) |
boolean |
equals(java.lang.Object obj) |
void |
fill(int fromRowIndex,
int fromColumnIndex,
T[][] b) |
void |
fill(T val) |
void |
fill(T[][] b) |
java.util.List<T> |
flatten() |
Matrix<T> |
flipH() |
Matrix<T> |
flipV() |
void |
forEach(Consumer<? super T> action) |
void |
forEach(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex,
Consumer<? super T> action) |
T |
get(int i,
int j) |
T |
get(Pair.IntPair point) |
T[] |
getLU2RD() |
T[] |
getRU2LD() |
int |
hashCode() |
Matrix<T> |
hstack(Matrix<T> b) |
NullabLe<T> |
leftOf(int i,
int j) |
<R> Matrix<R> |
map(java.lang.Class<R> cls,
Function<? super T,R> func) |
Matrix<T> |
map(Function<? super T,T> func) |
BooleanMatrix |
mapToBoolean(ToBooleanFunction<? super T> func) |
ByteMatrix |
mapToByte(ToByteFunction<? super T> func) |
CharMatrix |
mapToChar(ToCharFunction<? super T> func) |
DoubleMatrix |
mapToDouble(ToDoubleFunction<? super T> func) |
FloatMatrix |
mapToFloat(ToFloatFunction<? super T> func) |
IntMatrix |
mapToInt(ToIntFunction<? super T> func) |
LongMatrix |
mapToLong(ToLongFunction<? super T> func) |
ShortMatrix |
mapToShort(ToShortFunction<? super T> func) |
static <T> Matrix<T> |
of(T[]... a) |
static <T> Matrix<T> |
repeat(T val,
int len) |
Matrix<T> |
repelem(int rowRepeats,
int colRepeats)
Repeat elements
rowRepeats times in row direction and colRepeats times in column direction. |
void |
replaceIf(IntBiPredicate predicate,
T newValue)
Replace elements by
Predicate.test(i, j) based on points |
void |
replaceIf(Predicate<? super T> predicate,
T newValue) |
Matrix<T> |
repmat(int rowRepeats,
int colRepeats)
Repeat this matrix
rowRepeats times in row direction and colRepeats times in column direction. |
Matrix<T> |
reshape(int newRows,
int newCols) |
void |
reverseH() |
void |
reverseV() |
NullabLe<T> |
rightOf(int i,
int j) |
Matrix<T> |
rotate180()
Rotate this matrix clockwise 180
|
Matrix<T> |
rotate270()
Rotate this matrix clockwise 270
|
Matrix<T> |
rotate90()
Rotate this matrix clockwise 90
|
T[] |
row(int rowIndex) |
void |
set(int i,
int j,
T val) |
void |
set(Pair.IntPair point,
T val) |
void |
setColumn(int columnIndex,
T[] column) |
void |
setLU2RD(T[] diagonal) |
void |
setRow(int rowIndex,
T[] row) |
void |
setRU2LD(T[] diagonal) |
Stream<Stream<T>> |
streamC() |
Stream<Stream<T>> |
streamC(int fromColumnIndex,
int toColumnIndex) |
Stream<T> |
streamH() |
Stream<T> |
streamH(int rowIndex) |
Stream<T> |
streamH(int fromRowIndex,
int toRowIndex) |
Stream<T> |
streamLU2RD() |
Stream<Stream<T>> |
streamR() |
Stream<Stream<T>> |
streamR(int fromRowIndex,
int toRowIndex) |
Stream<T> |
streamRU2LD() |
Stream<T> |
streamV() |
Stream<T> |
streamV(int columnIndex) |
Stream<T> |
streamV(int fromColumnIndex,
int toColumnIndex) |
java.lang.String |
toString() |
Matrix<T> |
transpose() |
void |
updateAll(IntBiFunction<T> func)
Update all elements based on points
|
void |
updateAll(UnaryOperator<T> func) |
void |
updateColumn(int columnIndex,
UnaryOperator<T> func) |
void |
updateLU2RD(UnaryOperator<T> func) |
void |
updateRow(int rowIndex,
UnaryOperator<T> func) |
void |
updateRU2LD(UnaryOperator<T> func) |
NullabLe<T> |
upOf(int i,
int j) |
Matrix<T> |
vstack(Matrix<? extends T> b) |
<B,R> Matrix<R> |
zipWith(java.lang.Class<R> cls,
Matrix<B> matrixB,
BiFunction<? super T,? super B,R> zipFunction) |
<B,C,R> Matrix<R> |
zipWith(java.lang.Class<R> cls,
Matrix<B> matrixB,
Matrix<C> matrixC,
TriFunction<? super T,? super B,? super C,R> zipFunction) |
<B> Matrix<T> |
zipWith(Matrix<B> matrixB,
BiFunction<? super T,? super B,T> zipFunction) |
<B,C> Matrix<T> |
zipWith(Matrix<B> matrixB,
Matrix<C> matrixC,
TriFunction<? super T,? super B,? super C,T> zipFunction) |
isEmpty, isSameShape, pointsC, pointsC, pointsH, pointsH, pointsH, pointsLU2RD, pointsR, pointsR, pointsRU2LD, pointsV, pointsV, pointsV, println, reshape
public Matrix(T[][] a)
@SafeVarargs public static <T> Matrix<T> of(T[]... a)
public static <T> Matrix<T> repeat(T val, int len)
public static <T> Matrix<T> diagonalLU2RD(T[] leftUp2RighDownDiagonal)
public static <T> Matrix<T> diagonalRU2LD(T[] rightUp2LeftDownDiagonal)
public static <T> Matrix<T> diagonal(T[] leftUp2RighDownDiagonal, T[] rightUp2LeftDownDiagonal)
public T[][] array()
public T get(int i, int j)
public T get(Pair.IntPair point)
public void set(int i, int j, T val)
public void set(Pair.IntPair point, T val)
public Stream<Pair.IntPair> adjacent4Points(int i, int j)
null
is set if the adjacency doesn't exist.i
- j
- public Stream<Pair.IntPair> adjacent8Points(int i, int j)
null
is set if the adjacency doesn't exist.i
- j
- public T[] row(int rowIndex)
public T[] column(int columnIndex)
public void setRow(int rowIndex, T[] row)
public void setColumn(int columnIndex, T[] column)
public void updateRow(int rowIndex, UnaryOperator<T> func)
public void updateColumn(int columnIndex, UnaryOperator<T> func)
public T[] getLU2RD()
public void setLU2RD(T[] diagonal)
public void updateLU2RD(UnaryOperator<T> func)
public T[] getRU2LD()
public void setRU2LD(T[] diagonal)
public void updateRU2LD(UnaryOperator<T> func)
public void updateAll(UnaryOperator<T> func)
public void updateAll(IntBiFunction<T> func)
func
- public void replaceIf(IntBiPredicate predicate, T newValue)
Predicate.test(i, j)
based on pointspredicate
- newValue
- public BooleanMatrix mapToBoolean(ToBooleanFunction<? super T> func)
public ByteMatrix mapToByte(ToByteFunction<? super T> func)
public CharMatrix mapToChar(ToCharFunction<? super T> func)
public ShortMatrix mapToShort(ToShortFunction<? super T> func)
public IntMatrix mapToInt(ToIntFunction<? super T> func)
public LongMatrix mapToLong(ToLongFunction<? super T> func)
public FloatMatrix mapToFloat(ToFloatFunction<? super T> func)
public DoubleMatrix mapToDouble(ToDoubleFunction<? super T> func)
public void fill(T val)
public void fill(T[][] b)
public void fill(int fromRowIndex, int fromColumnIndex, T[][] b)
public Matrix<T> copy(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex)
public void reverseH()
public void reverseV()
public Matrix<T> rotate90()
AbstractMatrix
public Matrix<T> rotate180()
AbstractMatrix
public Matrix<T> rotate270()
AbstractMatrix
public Matrix<T> repelem(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.public Matrix<T> repmat(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.public java.util.List<T> flatten()
public Matrix<T> vstack(Matrix<? extends T> b)
b
- IntMatrix.vstack(IntMatrix)
public Matrix<T> hstack(Matrix<T> b)
b
- IntMatrix.hstack(IntMatrix)
public <B> Matrix<T> zipWith(Matrix<B> matrixB, BiFunction<? super T,? super B,T> zipFunction)
public <B,R> Matrix<R> zipWith(java.lang.Class<R> cls, Matrix<B> matrixB, BiFunction<? super T,? super B,R> zipFunction)
public <B,C> Matrix<T> zipWith(Matrix<B> matrixB, Matrix<C> matrixC, TriFunction<? super T,? super B,? super C,T> zipFunction)
public <B,C,R> Matrix<R> zipWith(java.lang.Class<R> cls, Matrix<B> matrixB, Matrix<C> matrixC, TriFunction<? super T,? super B,? super C,R> zipFunction)
public void forEach(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex, Consumer<? super T> action)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object