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<IntPair> |
adjacent4Points(int i,
int j)
Returns the four adjacencies with order: up, right, down, left.
|
Stream<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[] |
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) |
Matrix<T> |
extend(int newRows,
int newCols) |
Matrix<T> |
extend(int toUp,
int toDown,
int toLeft,
int toRight) |
Matrix<T> |
extend(int toUp,
int toDown,
int toLeft,
int toRight,
T defaultValueForNewCell) |
Matrix<T> |
extend(int newRows,
int newCols,
T defaultValueForNewCell) |
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() |
<E extends java.lang.Exception> |
forEach(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex,
Try.Consumer<? super T,E> action) |
<E extends java.lang.Exception> |
forEach(Try.Consumer<? super T,E> action) |
T |
get(int i,
int j) |
T |
get(IntPair point) |
T[] |
getLU2RD() |
T[] |
getRU2LD() |
int |
hashCode() |
Matrix<T> |
hstack(Matrix<? extends T> b) |
Nullable<T> |
leftOf(int i,
int j) |
<R,E extends java.lang.Exception> |
map(java.lang.Class<R> cls,
Try.Function<? super T,R,E> func) |
<E extends java.lang.Exception> |
map(Try.UnaryOperator<T,E> func) |
<E extends java.lang.Exception> |
mapToBoolean(Try.ToBooleanFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToByte(Try.ToByteFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToChar(Try.ToCharFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToDouble(Try.ToDoubleFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToFloat(Try.ToFloatFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToInt(Try.ToIntFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToLong(Try.ToLongFunction<? super T,E> func) |
<E extends java.lang.Exception> |
mapToShort(Try.ToShortFunction<? super T,E> 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. |
<E extends java.lang.Exception> |
replaceIf(Try.IntBiPredicate<E> predicate,
T newValue)
Replace elements by
Predicate.test(i, j) based on points |
<E extends java.lang.Exception> |
replaceIf(Try.Predicate<? super T,E> 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(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() |
<E extends java.lang.Exception> |
updateAll(Try.IntBiFunction<T,E> func)
Update all elements based on points
|
<E extends java.lang.Exception> |
updateAll(Try.UnaryOperator<T,E> func) |
<E extends java.lang.Exception> |
updateColumn(int columnIndex,
Try.UnaryOperator<T,E> func) |
<E extends java.lang.Exception> |
updateLU2RD(Try.UnaryOperator<T,E> func) |
<E extends java.lang.Exception> |
updateRow(int rowIndex,
Try.UnaryOperator<T,E> func) |
<E extends java.lang.Exception> |
updateRU2LD(Try.UnaryOperator<T,E> func) |
Nullable<T> |
upOf(int i,
int j) |
Matrix<T> |
vstack(Matrix<? extends T> b) |
<B,C,R,E extends java.lang.Exception> |
zipWith(java.lang.Class<R> cls,
Matrix<B> matrixB,
Matrix<C> matrixC,
Try.TriFunction<? super T,? super B,? super C,R,E> zipFunction) |
<B,R,E extends java.lang.Exception> |
zipWith(java.lang.Class<R> cls,
Matrix<B> matrixB,
Try.BiFunction<? super T,? super B,R,E> zipFunction) |
<B,C,E extends java.lang.Exception> |
zipWith(Matrix<B> matrixB,
Matrix<C> matrixC,
Try.TriFunction<? super T,? super B,? super C,T,E> zipFunction) |
<B,E extends java.lang.Exception> |
zipWith(Matrix<B> matrixB,
Try.BiFunction<? super T,? super B,T,E> zipFunction) |
array, 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 get(int i, int j)
public void set(int i, int j, T val)
public Stream<IntPair> adjacent4Points(int i, int j)
null
is set if the adjacency doesn't exist.i
- j
- public Stream<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 <E extends java.lang.Exception> void updateRow(int rowIndex, Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void updateColumn(int columnIndex, Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public T[] getLU2RD()
public void setLU2RD(T[] diagonal)
public <E extends java.lang.Exception> void updateLU2RD(Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public T[] getRU2LD()
public void setRU2LD(T[] diagonal)
public <E extends java.lang.Exception> void updateRU2LD(Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void updateAll(Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void updateAll(Try.IntBiFunction<T,E> func) throws E extends java.lang.Exception
func
- E extends java.lang.Exception
public <E extends java.lang.Exception> void replaceIf(Try.Predicate<? super T,E> predicate, T newValue) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void replaceIf(Try.IntBiPredicate<E> predicate, T newValue) throws E extends java.lang.Exception
Predicate.test(i, j)
based on pointspredicate
- newValue
- E extends java.lang.Exception
public <E extends java.lang.Exception> Matrix<T> map(Try.UnaryOperator<T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <R,E extends java.lang.Exception> Matrix<R> map(java.lang.Class<R> cls, Try.Function<? super T,R,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> BooleanMatrix mapToBoolean(Try.ToBooleanFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> ByteMatrix mapToByte(Try.ToByteFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> CharMatrix mapToChar(Try.ToCharFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> ShortMatrix mapToShort(Try.ToShortFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> IntMatrix mapToInt(Try.ToIntFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> LongMatrix mapToLong(Try.ToLongFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> FloatMatrix mapToFloat(Try.ToFloatFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> DoubleMatrix mapToDouble(Try.ToDoubleFunction<? super T,E> func) throws E extends java.lang.Exception
E extends java.lang.Exception
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 Matrix<T> extend(int toUp, int toDown, int toLeft, int toRight, T defaultValueForNewCell)
public void reverseH()
public void reverseV()
public Matrix<T> flipH()
IntMatrix.flipH()
public Matrix<T> flipV()
IntMatrix.flipV()
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<? extends T> b)
b
- IntMatrix.hstack(IntMatrix)
public <B,E extends java.lang.Exception> Matrix<T> zipWith(Matrix<B> matrixB, Try.BiFunction<? super T,? super B,T,E> zipFunction) throws E extends java.lang.Exception
E extends java.lang.Exception
public <B,R,E extends java.lang.Exception> Matrix<R> zipWith(java.lang.Class<R> cls, Matrix<B> matrixB, Try.BiFunction<? super T,? super B,R,E> zipFunction) throws E extends java.lang.Exception
E extends java.lang.Exception
public <B,C,E extends java.lang.Exception> Matrix<T> zipWith(Matrix<B> matrixB, Matrix<C> matrixC, Try.TriFunction<? super T,? super B,? super C,T,E> zipFunction) throws E extends java.lang.Exception
E extends java.lang.Exception
public <B,C,R,E extends java.lang.Exception> Matrix<R> zipWith(java.lang.Class<R> cls, Matrix<B> matrixB, Matrix<C> matrixC, Try.TriFunction<? super T,? super B,? super C,R,E> zipFunction) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void forEach(Try.Consumer<? super T,E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void forEach(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex, Try.Consumer<? super T,E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
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