Module ojalgo
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>myDelegateprivate booleanmySafe
-
Constructor Summary
Constructors Constructor Description DenseMutator2D(PhysicalStore<N> delegate)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccept(Access2D<?> supplied)voidadd(int row, int col, double value)voidadd(long index, double addend)voidadd(long row, long col, double value)voidadd(long row, long col, java.lang.Comparable<?> value)voidadd(long index, java.lang.Comparable<?> addend)Mbuild()longcount()count() == countRows() * countColumns()longcountColumns()Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.longcountRows()Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.doubledoubleValue(int row, int col)Extracts one element of this matrix as a double.voidexchangeColumns(long colA, long colB)voidexchangeRows(long rowA, long rowB)voidfillAll(N value)voidfillAll(NullaryFunction<?> supplier)voidfillColumn(long row, long column, N value)voidfillColumn(long row, long col, NullaryFunction<?> supplier)voidfillColumn(long row, long col, Access1D<N> values)voidfillColumn(long col, N value)voidfillColumn(long col, NullaryFunction<?> supplier)voidfillColumn(long col, Access1D<N> values)voidfillDiagonal(long row, long column, N value)voidfillDiagonal(long row, long col, NullaryFunction<?> supplier)voidfillDiagonal(long row, long col, Access1D<N> values)voidfillDiagonal(N value)voidfillDiagonal(NullaryFunction<?> supplier)voidfillDiagonal(Access1D<N> values)voidfillMatching(UnaryFunction<N> function, Access1D<N> arguments)voidfillMatching(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:this(i) = values(i)voidfillMatching(Access1D<N> left, BinaryFunction<N> function, Access1D<N> right)voidfillRange(long first, long limit, N value)voidfillRange(long first, long limit, NullaryFunction<?> supplier)voidfillRow(long row, long column, N value)voidfillRow(long row, long col, NullaryFunction<?> supplier)voidfillRow(long row, long col, Access1D<N> values)voidfillRow(long row, N value)voidfillRow(long row, NullaryFunction<?> supplier)voidfillRow(long row, Access1D<N> values)Mget()Nget(long row, long col)intgetColDim()intgetRowDim()(package private) abstract Minstantiate(MatrixStore<N> store)voidmodifyAll(UnaryFunction<N> modifier)voidmodifyAny(Transformation2D<N> modifier)voidmodifyColumn(long row, long col, UnaryFunction<N> modifier)voidmodifyColumn(long col, UnaryFunction<N> modifier)voidmodifyCompatible(BinaryFunction<N> operator, Access2D<N> right)voidmodifyCompatible(Access2D<N> left, BinaryFunction<N> operator)The "compatible" part of the method name references MATLAB's terminology "Compatible Array Sizes".voidmodifyDiagonal(long row, long col, UnaryFunction<N> modifier)voidmodifyDiagonal(UnaryFunction<N> modifier)voidmodifyMatching(BinaryFunction<N> function, Access1D<N> right)voidmodifyMatching(Access1D<N> left, BinaryFunction<N> function)voidmodifyMatchingInColumns(BinaryFunction<N> function, Access1D<N> right)Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)but with the arguments to the modifier function swapped.voidmodifyMatchingInColumns(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.voidmodifyMatchingInRows(BinaryFunction<N> function, Access1D<N> right)Same asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)but with the arguments to the modifier function swapped.voidmodifyMatchingInRows(Access1D<N> left, BinaryFunction<N> function)Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)but now the supplied left data structure is treated as a row.voidmodifyOne(long row, long col, UnaryFunction<N> modifier)voidmodifyOne(long index, UnaryFunction<N> modifier)voidmodifyRange(long first, long limit, UnaryFunction<N> modifier)voidmodifyRow(long row, long col, UnaryFunction<N> modifier)voidmodifyRow(long row, UnaryFunction<N> modifier)voidreset()Reset this mutable structure to some standard (all zeros) initial state.voidset(int row, int col, double value)voidset(long index, double value)voidset(long row, long col, java.lang.Comparable<?> value)voidset(long index, java.lang.Comparable<?> value)intsize()size() == getRowDim() * getColDim()voidsupplyTo(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, asList, axpy, dot, select, supplyTo, toList, 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, fillMatching
-
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, 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(int row, int col, double value)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, java.lang.Comparable<?> addend)- Specified by:
addin interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, double addend)- Specified by:
addin interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, java.lang.Comparable<?> value)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, double value)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
build
public M build()
- Specified by:
buildin interfaceFactory2D.Builder<N extends java.lang.Comparable<N>>
-
count
public long count()
Description copied from interface:Structure2Dcount() == countRows() * countColumns()- Specified by:
countin interfaceStructure1D- Specified by:
countin interfaceStructure2D
-
countColumns
public long countColumns()
Description copied from interface:Structure2DOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countColumnsin interfaceStructure2D- Returns:
- The number of columns
-
countRows
public long countRows()
Description copied from interface:Structure2DOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countRowsin interfaceStructure2D- Returns:
- The number of rows
-
doubleValue
public double doubleValue(int row, int col)Description copied from interface:Access2DExtracts one element of this matrix as a double.- Specified by:
doubleValuein 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:
exchangeColumnsin interfaceMutate2D.Exchangeable
-
exchangeRows
public void exchangeRows(long rowA, long rowB)- Specified by:
exchangeRowsin interfaceMutate2D.Exchangeable
-
fillAll
public void fillAll(N value)
- Specified by:
fillAllin interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillAll
public void fillAll(NullaryFunction<?> supplier)
- Specified by:
fillAllin interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, Access1D<N> values)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long col, Access1D<N> values)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long column, N value)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long row, long col, NullaryFunction<?> supplier)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, N value)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillColumn
public void fillColumn(long col, NullaryFunction<?> supplier)- Specified by:
fillColumnin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(Access1D<N> values)
- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long col, Access1D<N> values)- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long column, N value)- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(long row, long col, NullaryFunction<?> supplier)- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(N value)
- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillDiagonal
public void fillDiagonal(NullaryFunction<?> supplier)
- Specified by:
fillDiagonalin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(Access1D<?> values)
Description copied from interface:Mutate1D.FillableWill 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:
fillMatchingin interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(Access1D<N> left, BinaryFunction<N> function, Access1D<N> right)
- Specified by:
fillMatchingin interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillMatching
public void fillMatching(UnaryFunction<N> function, Access1D<N> arguments)
- Specified by:
fillMatchingin interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, N value)- Specified by:
fillRangein interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, NullaryFunction<?> supplier)- Specified by:
fillRangein interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, Access1D<N> values)- Specified by:
fillRowin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long col, Access1D<N> values)- Specified by:
fillRowin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long column, N value)- Specified by:
fillRowin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, long col, NullaryFunction<?> supplier)- Specified by:
fillRowin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, N value)- Specified by:
fillRowin interfaceMutate2D.Fillable<N extends java.lang.Comparable<N>>
-
fillRow
public void fillRow(long row, NullaryFunction<?> supplier)- Specified by:
fillRowin 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:
getColDimin interfaceStructure2D- Returns:
- The number of columns
-
getRowDim
public int getRowDim()
- Specified by:
getRowDimin interfaceStructure2D- Returns:
- The number of rows
-
modifyAll
public void modifyAll(UnaryFunction<N> modifier)
- Specified by:
modifyAllin interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyAny
public void modifyAny(Transformation2D<N> modifier)
- Specified by:
modifyAnyin interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyColumn
public void modifyColumn(long row, long col, UnaryFunction<N> modifier)- Specified by:
modifyColumnin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyColumn
public void modifyColumn(long col, UnaryFunction<N> modifier)- Specified by:
modifyColumnin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyCompatible
public void modifyCompatible(Access2D<N> left, BinaryFunction<N> operator)
Description copied from interface:Mutate2D.ModifiableReceiverThe "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:
modifyCompatiblein interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyCompatible
public void modifyCompatible(BinaryFunction<N> operator, Access2D<N> right)
- Specified by:
modifyCompatiblein interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyDiagonal
public void modifyDiagonal(long row, long col, UnaryFunction<N> modifier)- Specified by:
modifyDiagonalin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyDiagonal
public void modifyDiagonal(UnaryFunction<N> modifier)
- Specified by:
modifyDiagonalin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(Access1D<N> left, BinaryFunction<N> function)
- Specified by:
modifyMatchingin interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(BinaryFunction<N> function, Access1D<N> right)
- Specified by:
modifyMatchingin 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:
modifyMatchingInColumnsin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatchingInColumns
public void modifyMatchingInColumns(BinaryFunction<N> function, Access1D<N> right)
Description copied from interface:Mutate2D.ModifiableSame asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)but with the arguments to the modifier function swapped.- Specified by:
modifyMatchingInColumnsin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatchingInRows
public void modifyMatchingInRows(Access1D<N> left, BinaryFunction<N> function)
Description copied from interface:Mutate2D.ModifiableSame 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:
modifyMatchingInRowsin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatchingInRows
public void modifyMatchingInRows(BinaryFunction<N> function, Access1D<N> right)
Description copied from interface:Mutate2D.ModifiableSame asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)but with the arguments to the modifier function swapped.- Specified by:
modifyMatchingInRowsin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long row, long col, UnaryFunction<N> modifier)- Specified by:
modifyOnein interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long index, UnaryFunction<N> modifier)- Specified by:
modifyOnein interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>- Specified by:
modifyOnein interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRange
public void modifyRange(long first, long limit, UnaryFunction<N> modifier)- Specified by:
modifyRangein interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRow
public void modifyRow(long row, long col, UnaryFunction<N> modifier)- Specified by:
modifyRowin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRow
public void modifyRow(long row, UnaryFunction<N> modifier)- Specified by:
modifyRowin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
reset
public void reset()
Description copied from interface:Mutate1DReset 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:Structure2Dsize() == getRowDim() * getColDim()- Specified by:
sizein interfaceStructure1D- Specified by:
sizein interfaceStructure2D
-
supplyTo
public void supplyTo(TransformableRegion<N> receiver)
- Specified by:
supplyToin interfaceAccess2D.Collectable<N extends java.lang.Comparable<N>,M extends BasicMatrix<N,M>>
-
instantiate
abstract M instantiate(MatrixStore<N> store)
-
-