Package org.ojalgo.matrix
Class DenseMutator2D<N extends java.lang.Comparable<N>,M extends BasicMatrix<N,M>>
- java.lang.Object
-
- org.ojalgo.matrix.DenseMutator2D<N,M>
-
- All Implemented Interfaces:
java.util.function.Consumer<Access2D<?>>
,java.util.function.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 java.lang.Comparable<N>,M extends BasicMatrix<N,M>> extends java.lang.Object implements Mutate2D.ModifiableReceiver<N>, java.util.function.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 java.lang.Comparable<N>>, Access2D.Collectable<N extends java.lang.Comparable<N>,R extends Mutate2D>, Access2D.ColumnView<N extends java.lang.Comparable<N>>, Access2D.ElementView<N extends java.lang.Comparable<N>>, Access2D.RowView<N extends java.lang.Comparable<N>>, Access2D.SelectionView<N extends java.lang.Comparable<N>>, Access2D.Sliceable<N extends java.lang.Comparable<N>>, Access2D.Visitable<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate1D
Mutate1D.Fillable<N extends java.lang.Comparable<N>>, Mutate1D.Mixable<N extends java.lang.Comparable<N>>, Mutate1D.Modifiable<N extends java.lang.Comparable<N>>, Mutate1D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate1D.Receiver<N extends java.lang.Comparable<N>>, Mutate1D.Sortable
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate2D
Mutate2D.Exchangeable, Mutate2D.Fillable<N extends java.lang.Comparable<N>>, Mutate2D.Mixable<N extends java.lang.Comparable<N>>, Mutate2D.Modifiable<N extends java.lang.Comparable<N>>, Mutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate2D.Receiver<N extends java.lang.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 Modifier and Type Field Description private PhysicalStore<N>
myDelegate
private boolean
mySafe
-
Constructor Summary
Constructors Constructor Description DenseMutator2D(PhysicalStore<N> delegate)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Access2D<?> supplied)
void
add(long index, double addend)
void
add(long row, long col, double value)
void
add(long row, long col, java.lang.Comparable<?> value)
void
add(long index, java.lang.Comparable<?> addend)
M
build()
long
count()
count() == countRows() * countColumns()long
countColumns()
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.long
countRows()
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
fillAll(N value)
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
fillRange(long first, long limit, N value)
void
fillRange(long first, long limit, NullaryFunction<?> supplier)
void
fillRow(long row, long column, N value)
void
fillRow(long row, long col, NullaryFunction<?> supplier)
void
fillRow(long row, long col, Access1D<N> values)
void
fillRow(long row, N value)
void
fillRow(long row, NullaryFunction<?> supplier)
void
fillRow(long row, Access1D<N> values)
M
get()
N
get(long row, long col)
int
getColDim()
int
getRowDim()
(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, java.lang.Comparable<?> value)
void
set(long index, java.lang.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 Detail
-
myDelegate
private final PhysicalStore<N extends java.lang.Comparable<N>> myDelegate
-
mySafe
private boolean mySafe
-
-
Constructor Detail
-
DenseMutator2D
DenseMutator2D(PhysicalStore<N> delegate)
-
-
Method Detail
-
accept
public void accept(Access2D<?> supplied)
-
add
public void add(long index, java.lang.Comparable<?> addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, double addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, java.lang.Comparable<?> value)
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, double value)
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
build
public M build()
- Specified by:
build
in interfaceFactory2D.Builder<N extends java.lang.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 java.lang.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
public void fillAll(N value)
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillAll
public void fillAll(NullaryFunction<?> supplier)
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, Access1D<N> values)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long col, Access1D<N> values)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long column, N value)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long col, NullaryFunction<?> supplier)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, N value)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, NullaryFunction<?> supplier)
- Specified by:
fillColumn
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(Access1D<N> values)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long col, Access1D<N> values)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long column, N value)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long col, NullaryFunction<?> supplier)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(N value)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(NullaryFunction<?> supplier)
- Specified by:
fillDiagonal
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(Access1D<?> values)
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 java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(Access1D<N> left, BinaryFunction<N> function, Access1D<N> right)
- Specified by:
fillMatching
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(UnaryFunction<N> function, Access1D<N> arguments)
- Specified by:
fillMatching
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, N value)
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, NullaryFunction<?> supplier)
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, Access1D<N> values)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long col, Access1D<N> values)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long column, N value)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long col, NullaryFunction<?> supplier)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, N value)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, NullaryFunction<?> supplier)
- Specified by:
fillRow
in interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
get
public M get()
-
get
public N get(long row, long col)
-
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
public void modifyAll(UnaryFunction<N> modifier)
- Specified by:
modifyAll
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyAny
public void modifyAny(Transformation2D<N> modifier)
- Specified by:
modifyAny
in interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyColumn
public void modifyColumn(long row, long col, UnaryFunction<N> modifier)
- Specified by:
modifyColumn
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyColumn
public void modifyColumn(long col, UnaryFunction<N> modifier)
- Specified by:
modifyColumn
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyCompatible
public void modifyCompatible(Access2D<N> left, BinaryFunction<N> operator)
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 java.lang.Comparable<N>>
-
modifyCompatible
public void modifyCompatible(BinaryFunction<N> operator, Access2D<N> right)
- Specified by:
modifyCompatible
in interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyDiagonal
public void modifyDiagonal(long row, long col, UnaryFunction<N> modifier)
- Specified by:
modifyDiagonal
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyDiagonal
public void modifyDiagonal(UnaryFunction<N> modifier)
- Specified by:
modifyDiagonal
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(Access1D<N> left, BinaryFunction<N> function)
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(BinaryFunction<N> function, Access1D<N> right)
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatchingInColumns
public void modifyMatchingInColumns(Access1D<N> left, BinaryFunction<N> function)
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 java.lang.Comparable<N>>
-
modifyMatchingInColumns
public void modifyMatchingInColumns(BinaryFunction<N> function, Access1D<N> right)
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 java.lang.Comparable<N>>
-
modifyMatchingInRows
public void modifyMatchingInRows(Access1D<N> left, BinaryFunction<N> function)
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 java.lang.Comparable<N>>
-
modifyMatchingInRows
public void modifyMatchingInRows(BinaryFunction<N> function, Access1D<N> right)
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 java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long row, long col, UnaryFunction<N> modifier)
- Specified by:
modifyOne
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long index, UnaryFunction<N> modifier)
- Specified by:
modifyOne
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
modifyOne
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRange
public void modifyRange(long first, long limit, UnaryFunction<N> modifier)
- Specified by:
modifyRange
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRow
public void modifyRow(long row, long col, UnaryFunction<N> modifier)
- Specified by:
modifyRow
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRow
public void modifyRow(long row, UnaryFunction<N> modifier)
- Specified by:
modifyRow
in interfaceMutate2D.Modifiable<N extends java.lang.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(long index, java.lang.Comparable<?> value)
-
set
public void set(long index, double value)
-
set
public void set(long row, long col, java.lang.Comparable<?> value)
-
size
public int size()
Description copied from interface:Structure2D
size() == getRowDim() * getColDim()- Specified by:
size
in interfaceStructure1D
- Specified by:
size
in interfaceStructure2D
-
supplyTo
public void supplyTo(TransformableRegion<N> receiver)
- Specified by:
supplyTo
in interfaceAccess2D.Collectable<N extends java.lang.Comparable<N>,M extends BasicMatrix<N,M>>
-
instantiate
abstract M instantiate(MatrixStore<N> store)
-
-