Package org.ojalgo.matrix
Class DenseMutator2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
java.lang.Object
org.ojalgo.matrix.DenseMutator2D<N,M>
- All Implemented Interfaces:
Consumer<Access2D<?>>
,Supplier<M>
,Access1D<N>
,Access2D<N>
,Access2D.Collectable<N,
,TransformableRegion<N>> Factory2D.Builder<M>
,Mutate1D
,Mutate1D.Fillable<N>
,Mutate1D.Modifiable<N>
,Mutate2D
,Mutate2D.Exchangeable
,Mutate2D.Fillable<N>
,Mutate2D.Modifiable<N>
,Mutate2D.ModifiableReceiver<N>
,Mutate2D.Receiver<N>
,Structure1D
,Structure2D
- Direct Known Subclasses:
MatrixC128.DenseReceiver
,MatrixH256.DenseReceiver
,MatrixQ128.DenseReceiver
,MatrixR032.DenseReceiver
,MatrixR064.DenseReceiver
,MatrixR128.DenseReceiver
abstract class DenseMutator2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
extends Object
implements Mutate2D.ModifiableReceiver<N>, Supplier<M>, Access2D.Collectable<N,TransformableRegion<N>>, Factory2D.Builder<M>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access2D
Access2D.Aggregatable<N extends Comparable<N>>, Access2D.Collectable<N extends Comparable<N>,
R extends Mutate2D>, Access2D.ColumnView<N extends Comparable<N>>, Access2D.ElementView<N extends Comparable<N>>, Access2D.RowView<N extends Comparable<N>>, Access2D.SelectionView<N extends Comparable<N>>, Access2D.Sliceable<N extends Comparable<N>>, Access2D.Visitable<N extends Comparable<N>> Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate1D
Mutate1D.Fillable<N extends Comparable<N>>, Mutate1D.Mixable<N extends Comparable<N>>, Mutate1D.Modifiable<N extends Comparable<N>>, Mutate1D.ModifiableReceiver<N extends Comparable<N>>, Mutate1D.Receiver<N extends Comparable<N>>, Mutate1D.Sortable
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate2D
Mutate2D.Exchangeable, Mutate2D.Fillable<N extends Comparable<N>>, Mutate2D.Mixable<N extends Comparable<N>>, Mutate2D.Modifiable<N extends Comparable<N>>, Mutate2D.ModifiableReceiver<N extends Comparable<N>>, Mutate2D.Receiver<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,
B extends Structure1D.Logical<S, B>>, Structure1D.LongIndex, Structure1D.LoopCallback Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,
B extends Structure2D.Logical<S, B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R, C>, Structure2D.RowColumnMapper<R, C> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(long index, double addend) void
add
(long row, long col, double value) void
add
(long row, long col, Comparable<?> value) void
add
(long index, Comparable<?> addend) build()
long
count()
count() == countRows() * countColumns()long
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.long
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.double
doubleValue
(int row, int col) Extracts one element of this matrix as a double.void
exchangeColumns
(long colA, long colB) void
exchangeRows
(long rowA, long rowB) void
void
fillAll
(NullaryFunction<?> supplier) void
fillColumn
(long row, long column, N value) void
fillColumn
(long row, long col, NullaryFunction<?> supplier) void
fillColumn
(long row, long col, Access1D<N> values) void
fillColumn
(long col, N value) void
fillColumn
(long col, NullaryFunction<?> supplier) void
fillColumn
(long col, Access1D<N> values) void
fillDiagonal
(long row, long column, N value) void
fillDiagonal
(long row, long col, NullaryFunction<?> supplier) void
fillDiagonal
(long row, long col, Access1D<N> values) void
fillDiagonal
(N value) void
fillDiagonal
(NullaryFunction<?> supplier) void
fillDiagonal
(Access1D<N> values) void
fillMatching
(UnaryFunction<N> function, Access1D<N> arguments) void
fillMatching
(Access1D<?> values) Will fill the elements of [this] with the corresponding input values, and in the process (if necessary) convert the elements to the correct type:void
fillMatching
(Access1D<N> left, BinaryFunction<N> function, Access1D<N> right) void
void
fillRange
(long first, long limit, NullaryFunction<?> supplier) void
void
fillRow
(long row, long col, NullaryFunction<?> supplier) void
void
void
fillRow
(long row, NullaryFunction<?> supplier) void
get()
get
(long row, long col) int
int
(package private) abstract M
instantiate
(MatrixStore<N> store) void
modifyAll
(UnaryFunction<N> modifier) void
modifyAny
(Transformation2D<N> modifier) void
modifyColumn
(long row, long col, UnaryFunction<N> modifier) void
modifyColumn
(long col, UnaryFunction<N> modifier) void
modifyCompatible
(BinaryFunction<N> operator, Access2D<N> right) void
modifyCompatible
(Access2D<N> left, BinaryFunction<N> operator) The "compatible" part of the method name references MATLAB's terminology "Compatible Array Sizes".void
modifyDiagonal
(long row, long col, UnaryFunction<N> modifier) void
modifyDiagonal
(UnaryFunction<N> modifier) void
modifyMatching
(BinaryFunction<N> function, Access1D<N> right) void
modifyMatching
(Access1D<N> left, BinaryFunction<N> function) void
modifyMatchingInColumns
(BinaryFunction<N> function, Access1D<N> right) Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped.void
modifyMatchingInColumns
(Access1D<N> left, BinaryFunction<N> function) "Matching In Columns" refers to that the supplied, left, data structure will be treated as a column, matching the columns of this structure.void
modifyMatchingInRows
(BinaryFunction<N> function, Access1D<N> right) Same asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped.void
modifyMatchingInRows
(Access1D<N> left, BinaryFunction<N> function) Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)
but now the supplied left data structure is treated as a row.void
modifyOne
(long row, long col, UnaryFunction<N> modifier) void
modifyOne
(long index, UnaryFunction<N> modifier) void
modifyRange
(long first, long limit, UnaryFunction<N> modifier) void
modifyRow
(long row, long col, UnaryFunction<N> modifier) void
modifyRow
(long row, UnaryFunction<N> modifier) void
reset()
Reset this mutable structure to some standard (all zeros) initial state.void
set
(int row, int col, double value) void
set
(long index, double value) void
set
(long row, long col, Comparable<?> value) void
set
(long index, Comparable<?> value) int
size()
size() == getRowDim() * getColDim()void
supplyTo
(TransformableRegion<N> receiver) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, axpy, dot, select, supplyTo, toRawCopy1D
Methods inherited from interface org.ojalgo.structure.Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, byteValue, byteValue, columns, columns, columns, doubleValue, doubleValue, doubleValue, elements, floatValue, floatValue, floatValue, floatValue, get, intValue, intValue, intValue, intValue, longValue, longValue, longValue, longValue, nonzeros, rows, rows, rows, select, select, shortValue, shortValue, shortValue, shortValue, toRawCopy2D
Methods inherited from interface org.ojalgo.structure.Access2D.Collectable
collect
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillCompatible
Methods inherited from interface org.ojalgo.structure.Mutate2D
set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set
Methods inherited from interface org.ojalgo.structure.Mutate2D.Fillable
fillCompatible
Methods inherited from interface org.ojalgo.structure.Mutate2D.Modifiable
add, add, add, add, add, add, add, add, add, add
Methods inherited from interface org.ojalgo.structure.Mutate2D.Receiver
isAcceptable
Methods inherited from interface org.ojalgo.structure.Structure2D
firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow
-
Field Details
-
myDelegate
-
mySafe
private boolean mySafe
-
-
Constructor Details
-
DenseMutator2D
DenseMutator2D(PhysicalStore<N> delegate)
-
-
Method Details
-
accept
- Specified by:
accept
in interfaceConsumer<N extends Comparable<N>>
- Specified by:
accept
in interfaceMutate2D.Receiver<N extends Comparable<N>>
-
add
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, double addend) - Specified by:
add
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
add
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
add
public void add(long row, long col, double value) - Specified by:
add
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
build
- Specified by:
build
in interfaceFactory2D.Builder<N extends Comparable<N>>
-
count
public long count()Description copied from interface:Structure2D
count() == countRows() * countColumns()- Specified by:
count
in interfaceStructure1D
- Specified by:
count
in interfaceStructure2D
-
countColumns
public long countColumns()Description copied from interface:Structure2D
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countColumns
in interfaceStructure2D
- Returns:
- The number of columns
-
countRows
public long countRows()Description copied from interface:Structure2D
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countRows
in interfaceStructure2D
- Returns:
- The number of rows
-
doubleValue
public double doubleValue(int row, int col) Description copied from interface:Access2D
Extracts one element of this matrix as a double.- Specified by:
doubleValue
in interfaceAccess2D<N extends Comparable<N>>
- Parameters:
row
- A row index.col
- A column index.- Returns:
- One matrix element
-
exchangeColumns
public void exchangeColumns(long colA, long colB) - Specified by:
exchangeColumns
in interfaceMutate2D.Exchangeable
-
exchangeRows
public void exchangeRows(long rowA, long rowB) - Specified by:
exchangeRows
in interfaceMutate2D.Exchangeable
-
fillAll
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillAll
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillColumn
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillDiagonal
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillMatching
Description copied from interface:Mutate1D.Fillable
Will fill the elements of [this] with the corresponding input values, and in the process (if necessary) convert the elements to the correct type:
this(i) = values(i)
- Specified by:
fillMatching
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillMatching
- Specified by:
fillMatching
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillMatching
- Specified by:
fillMatching
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillRange
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillRange
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
fillRow
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends Comparable<N>>
-
get
- Specified by:
get
in interfaceSupplier<N extends Comparable<N>>
-
get
- Specified by:
get
in interfaceAccess2D<N extends Comparable<N>>
-
getColDim
public int getColDim()- Specified by:
getColDim
in interfaceStructure2D
- Returns:
- The number of columns
-
getRowDim
public int getRowDim()- Specified by:
getRowDim
in interfaceStructure2D
- Returns:
- The number of rows
-
modifyAll
- Specified by:
modifyAll
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyAny
- Specified by:
modifyAny
in interfaceMutate2D.ModifiableReceiver<N extends Comparable<N>>
-
modifyColumn
- Specified by:
modifyColumn
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyColumn
- Specified by:
modifyColumn
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyCompatible
Description copied from interface:Mutate2D.ModifiableReceiver
The "compatible" part of the method name references MATLAB's terminology "Compatible Array Sizes". Here the possible combinations are somewhat limited as 'this' is modified in-place.- Specified by:
modifyCompatible
in interfaceMutate2D.ModifiableReceiver<N extends Comparable<N>>
-
modifyCompatible
- Specified by:
modifyCompatible
in interfaceMutate2D.ModifiableReceiver<N extends Comparable<N>>
-
modifyDiagonal
- Specified by:
modifyDiagonal
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyDiagonal
- Specified by:
modifyDiagonal
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyMatching
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyMatching
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyMatchingInColumns
Description copied from interface:Mutate2D.Modifiable
"Matching In Columns" refers to that the supplied, left, data structure will be treated as a column, matching the columns of this structure. Matching columns have the same number of rows.This method will modify all elements of this structure by applying the modifier function to each of them. The left/first argument to the modifier function is taken from the supplied data structure, and the row-index determines which element.
- Specified by:
modifyMatchingInColumns
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyMatchingInColumns
Description copied from interface:Mutate2D.Modifiable
Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped.- Specified by:
modifyMatchingInColumns
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyMatchingInRows
Description copied from interface:Mutate2D.Modifiable
Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)
but now the supplied left data structure is treated as a row. (Matching rows have the same number of columns.)- Specified by:
modifyMatchingInRows
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyMatchingInRows
Description copied from interface:Mutate2D.Modifiable
Same asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped.- Specified by:
modifyMatchingInRows
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyOne
- Specified by:
modifyOne
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyOne
- Specified by:
modifyOne
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
- Specified by:
modifyOne
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyRange
- Specified by:
modifyRange
in interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyRow
- Specified by:
modifyRow
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
modifyRow
- Specified by:
modifyRow
in interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
reset
public void reset()Description copied from interface:Mutate1D
Reset this mutable structure to some standard (all zeros) initial state. It must still be usuable after this call, and the structure/size/shape must not change. -
set
public void set(int row, int col, double value) -
set
-
set
public void set(long index, double value) -
set
-
size
public int size()Description copied from interface:Structure2D
size() == getRowDim() * getColDim()- Specified by:
size
in interfaceStructure1D
- Specified by:
size
in interfaceStructure2D
-
supplyTo
- Specified by:
supplyTo
in interfaceAccess2D.Collectable<N extends Comparable<N>,
M extends BasicMatrix<N, M>>
-
instantiate
-