Class Subregion2D.SynchronizedRegion<N extends Comparable<N>>
java.lang.Object
org.ojalgo.matrix.store.Subregion2D<N>
org.ojalgo.matrix.store.Subregion2D.SynchronizedRegion<N>
- All Implemented Interfaces:
Consumer<Access2D<?>>, TransformableRegion<N>, Access1D<N>, Access2D<N>, Mutate1D, Mutate1D.Fillable<N>, Mutate1D.Modifiable<N>, Mutate2D, Mutate2D.Exchangeable, Mutate2D.Fillable<N>, Mutate2D.Modifiable<N>, Mutate2D.ModifiableReceiver<N>, Mutate2D.Receiver<N>, Structure1D, Structure2D
- Enclosing class:
Subregion2D<N extends Comparable<N>>
-
Nested Class Summary
Nested classes/interfaces inherited from class Subregion2D
Subregion2D.ColumnsRegion<N>, Subregion2D.LimitRegion<N>, Subregion2D.OffsetRegion<N>, Subregion2D.RowsRegion<N>, Subregion2D.SynchronizedRegion<N>, Subregion2D.TransposedRegion<N>, Subregion2D.WrapperRegion<N>Nested classes/interfaces inherited from interface Access2D
Access2D.Aggregatable<N>, Access2D.Collectable<N,R>, Access2D.ColumnView<N>, Access2D.ElementView<N>, Access2D.RowView<N>, Access2D.SelectionView<N>, Access2D.Sliceable<N>, Access2D.Visitable<N> Nested classes/interfaces inherited from interface Mutate1D
Mutate1D.Fillable<N>, Mutate1D.Mixable<N>, Mutate1D.Modifiable<N>, Mutate1D.ModifiableReceiver<N>, Mutate1D.Receiver<N>, Mutate1D.SortableNested classes/interfaces inherited from interface Mutate2D
Mutate2D.Exchangeable, Mutate2D.Fillable<N>, Mutate2D.Mixable<N>, Mutate2D.Modifiable<N>, Mutate2D.ModifiableReceiver<N>, Mutate2D.Receiver<N>Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S,B>, Structure1D.LongIndex, Structure1D.LoopCallback Nested classes/interfaces inherited from interface Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S,B>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R>, Structure2D.Reshapable, Structure2D.RowColumnKey<R, C>, Structure2D.RowColumnMapper<R, C> Nested classes/interfaces inherited from interface TransformableRegion
TransformableRegion.FillByMultiplying<N> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd(int row, int col, double addend) voidadd(long index, byte addend) voidadd(long index, double addend) voidadd(long index, float addend) voidadd(long index, int addend) voidadd(long index, long addend) voidadd(long row, long col, byte addend) voidadd(long row, long col, double addend) voidadd(long row, long col, float addend) voidadd(long row, long col, int addend) voidadd(long row, long col, long addend) voidadd(long row, long col, short addend) voidadd(long row, long col, Comparable<?> addend) voidadd(long index, short addend) voidadd(long index, Comparable<?> addend) <NN extends Comparable<NN>, R extends Mutate1D.Receiver<NN>>
Access1D.Collectable<NN, R> <NN extends Comparable<NN>, R extends Mutate2D.Receiver<NN>>
Access2D.Collectable<NN, R> asKeyed1D(Structure1D.IndexMapper<K> indexMapper) asKeyed2D(Structure1D.IndexMapper<R> rowMapper, Structure1D.IndexMapper<C> columnMapper) voidaxpy(double a, Mutate1D.Modifiable<?> y) Will calculate y = y + a x, will add "a" times "this" to "y"bytebyteValue(int index) bytebyteValue(int row, int col) bytebyteValue(long index) bytebyteValue(long row, long col) columns()columns(int... columns) columns(long... columns) longcount()count() == countRows() * countColumns()longOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.longOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.doubleWill calculate and return the dot product of this 1D-structure and another input 1D-vector.doubledoubleValue(int index) doubledoubleValue(int row, int col) Extracts one element of this matrix as a double.doubledoubleValue(long index) doubledoubleValue(long row, long col) ElementView2D<N, ?> elements()Returns an Iterable of ElementView1D.voidexchangeColumns(long colA, long colB) voidexchangeRows(long rowA, long rowB) voidvoidfillAll(NullaryFunction<?> supplier) voidfillColumn(long row, long col, 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) voidfillCompatible(Access1D<N> left, BinaryFunction<N> operator, Access1D<N> right) voidfillCompatible(Access2D<N> left, BinaryFunction<N> operator, Access2D<N> right) 'this' needs to be of a size compatible with the 'left' and 'right' matrices.voidfillDiagonal(long row, long col, 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) voidvoidfillRange(long first, long limit, NullaryFunction<?> supplier) voidvoidfillRow(long row, long col, NullaryFunction<?> supplier) voidvoidvoidfillRow(long row, NullaryFunction<?> supplier) voidintfirstInColumn(int col) The default value is simply0, and if all elements are zeros thenthis.countRows().intfirstInRow(int row) The default value is simply0, and if all elements are zeros thenthis.countColumns().floatfloatValue(int index) floatfloatValue(int row, int col) floatfloatValue(long index) floatfloatValue(long row, long col) get(long index) get(long row, long col) intintintintintintValue(int index) intintValue(int row, int col) intintValue(long index) intintValue(long row, long col) booleanisAcceptable(Structure2D supplier) booleanisEmpty()2D data structures are either square, tall, fat or empty.booleanisFat()2D data structures are either square, tall, fat or empty.booleanisScalar()booleanisSquare()2D data structures are either square, tall, fat or empty.booleanisTall()2D data structures are either square, tall, fat or empty.booleanisVector()intlimitOfColumn(int col) The default value is simplythis.countRows(), and if all elements are zeros then0.intlimitOfRow(int row) The default value is simplythis.countColumns(), and if all elements are zeros then0.longlongValue(int index) longlongValue(int row, int col) longlongValue(long index) longlongValue(long row, long col) 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) ElementView2D<N, ?> nonzeros()Similar toAccess1D.elements()but avoids elements that are structurally known to be zero.voidreset()Reset this mutable structure to some standard (all zeros) initial state.rows()rows(int... rows) rows(long... rows) select(int[] rows, int[] columns) select(long... selection) Creates a view of the underlying data structure of only the selected elements.select(long[] rows, long[] columns) Creates a view of the underlying data structure of only the selected elements.voidset(int index, byte value) voidset(int index, double value) voidset(int index, float value) voidset(int index, int value) voidset(int row, int col, byte value) voidset(int row, int col, double value) voidset(int row, int col, float value) voidset(int row, int col, int value) voidset(int row, int col, long value) voidset(int row, int col, short value) voidset(int index, long value) voidset(int index, short value) voidset(long index, byte value) voidset(long index, double value) voidset(long index, float value) voidset(long index, int value) voidset(long index, long value) voidset(long row, long col, byte value) voidset(long row, long col, double value) voidset(long row, long col, float value) voidset(long row, long col, int value) voidset(long row, long col, long value) voidset(long row, long col, short value) voidset(long row, long col, Comparable<?> value) voidset(long index, short value) voidset(long index, Comparable<?> value) shortshortValue(int index) shortshortValue(int row, int col) shortshortValue(long index) shortshortValue(long row, long col) intsize()size() == getRowDim() * getColDim()voidsupplyTo(double[] receiver) double[]double[][]Methods inherited from class Subregion2D
fillByMultiplying, findMultiplier, findMultiplier, regionByColumns, regionByLimits, regionByOffsets, regionByRows, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Mutate1D.Fillable
fillMatchingMethods inherited from interface Mutate2D.Modifiable
addMethods inherited from interface TransformableRegion
synchronised
-
Field Details
-
myDelegate
-
-
Constructor Details
-
SynchronizedRegion
SynchronizedRegion(TransformableRegion<N> base)
-
-
Method Details
-
accept
-
add
public void add(int row, int col, double addend) -
add
public void add(long index, byte addend) -
add
-
add
public void add(long index, double addend) -
add
public void add(long index, float addend) -
add
public void add(long index, int addend) -
add
public void add(long index, long addend) -
add
public void add(long row, long col, byte addend) -
add
-
add
public void add(long row, long col, double addend) -
add
public void add(long row, long col, float addend) -
add
public void add(long row, long col, int addend) -
add
public void add(long row, long col, long addend) -
add
public void add(long row, long col, short addend) -
add
public void add(long index, short addend) -
andThen
-
asCollectable1D
public <NN extends Comparable<NN>, R extends Mutate1D.Receiver<NN>> Access1D.Collectable<NN,R> asCollectable1D()Description copied from interface:Access1D -
asCollectable2D
public <NN extends Comparable<NN>, R extends Mutate2D.Receiver<NN>> Access2D.Collectable<NN,R> asCollectable2D() -
asKeyed1D
-
asKeyed2D
public <R,C> Keyed2D<R,C, asKeyed2DN> (Structure1D.IndexMapper<R> rowMapper, Structure1D.IndexMapper<C> columnMapper) -
axpy
Description copied from interface:Access1DWill calculate y = y + a x, will add "a" times "this" to "y"- Parameters:
a- The scaley- The "vector" to update
-
byteValue
public byte byteValue(int index) -
byteValue
public byte byteValue(int row, int col) -
byteValue
public byte byteValue(long index) -
byteValue
public byte byteValue(long row, long col) -
columns
-
columns
-
columns
-
count
public long count()Description copied from interface:Structure2Dcount() == countRows() * countColumns() -
countColumns
public long countColumns()Description copied from interface:Structure2DOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.- 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.- Returns:
- The number of rows
-
dot
-
doubleValue
public double doubleValue(int index) -
doubleValue
public double doubleValue(int row, int col) Description copied from interface:Access2DExtracts one element of this matrix as a double.- Parameters:
row- A row index.col- A column index.- Returns:
- One matrix element
-
doubleValue
public double doubleValue(long index) -
doubleValue
public double doubleValue(long row, long col) -
elements
Description copied from interface:Access1DReturns an Iterable of ElementView1D. It allows to iterate over the instance's element "positions" without actually extracting the elements (unless you explicitly do so). -
exchangeColumns
public void exchangeColumns(long colA, long colB) -
exchangeRows
public void exchangeRows(long rowA, long rowB) -
fillAll
-
fillAll
-
fillColumn
-
fillColumn
-
fillColumn
-
fillColumn
-
fillColumn
-
fillColumn
-
fillCompatible
-
fillCompatible
Description copied from interface:Mutate2D.Fillable'this' needs to be of a size compatible with the 'left' and 'right' matrices. No checks are performed. The term "compatible" refers to MATLAB's rules for "array broadcasting". The result will be the same as if the 'left' and 'right' matrices where expanded (repeated) so that all three where of the same size, and then the operation was performed. The actual implementation may be more efficient than that. -
fillDiagonal
-
fillDiagonal
-
fillDiagonal
-
fillDiagonal
-
fillDiagonal
-
fillDiagonal
-
fillMatching
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 Comparable<N>>- Overrides:
fillMatchingin classSubregion2D<N extends Comparable<N>>
-
fillMatching
-
fillMatching
-
fillRange
-
fillRange
-
fillRow
-
fillRow
-
fillRow
-
fillRow
-
fillRow
-
fillRow
-
firstInColumn
public int firstInColumn(int col) Description copied from interface:Structure2DThe default value is simply0, and if all elements are zeros thenthis.countRows().- Parameters:
col- The column index- Returns:
- The row index of the first non-zero element in the specified column
-
firstInRow
public int firstInRow(int row) Description copied from interface:Structure2DThe default value is simply0, and if all elements are zeros thenthis.countColumns().- Returns:
- The column index of the first non-zero element in the specified row
-
floatValue
public float floatValue(int index) -
floatValue
public float floatValue(int row, int col) -
floatValue
public float floatValue(long index) -
floatValue
public float floatValue(long row, long col) -
get
-
get
-
getColDim
public int getColDim()- Returns:
- The number of columns
-
getMaxDim
public int getMaxDim() -
getMinDim
public int getMinDim() -
getRowDim
public int getRowDim()- Returns:
- The number of rows
-
intValue
public int intValue(int index) -
intValue
public int intValue(int row, int col) -
intValue
public int intValue(long index) -
intValue
public int intValue(long row, long col) -
isAcceptable
-
isEmpty
public boolean isEmpty()Description copied from interface:Structure2D2D data structures are either square, tall, fat or empty.m <= 0 or n <= 0
Historically some ojAlgo data structures did allow to create "empty" instances. Currently this is not encouraged, but still possible in some instances.- Returns:
- true if matrix is empty
-
isFat
public boolean isFat()Description copied from interface:Structure2D2D data structures are either square, tall, fat or empty.1 <= m < n
- Returns:
- true if matrix is fat
-
isScalar
public boolean isScalar()- Returns:
- true if both the row and column dimensions are equal to 1.
-
isSquare
public boolean isSquare()Description copied from interface:Structure2D2D data structures are either square, tall, fat or empty.m = n <> 0
- Returns:
- true if matrix is square
-
isTall
public boolean isTall()Description copied from interface:Structure2D2D data structures are either square, tall, fat or empty.m < n >= 1
- Returns:
- true if matrix is tall
-
isVector
public boolean isVector()- Returns:
- true if either the row or column dimensions are equal to 1.
-
limitOfColumn
public int limitOfColumn(int col) Description copied from interface:Structure2DThe default value is simplythis.countRows(), and if all elements are zeros then0.- Returns:
- The row index of the first zero element, after all non-zeros, in the specified column (index of the last non-zero + 1)
-
limitOfRow
public int limitOfRow(int row) Description copied from interface:Structure2DThe default value is simplythis.countColumns(), and if all elements are zeros then0.- Returns:
- The column index of the first zero element, after all non-zeros, in the specified row (index of the last non-zero + 1)
-
longValue
public long longValue(int index) -
longValue
public long longValue(int row, int col) -
longValue
public long longValue(long index) -
longValue
public long longValue(long row, long col) -
modifyAll
-
modifyAny
-
modifyColumn
-
modifyColumn
-
modifyCompatible
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. -
modifyCompatible
-
modifyDiagonal
-
modifyDiagonal
-
modifyMatching
-
modifyMatching
-
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.
-
modifyMatchingInColumns
Description copied from interface:Mutate2D.ModifiableSame asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)but with the arguments to the modifier function swapped. -
modifyMatchingInRows
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.) -
modifyMatchingInRows
Description copied from interface:Mutate2D.ModifiableSame asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)but with the arguments to the modifier function swapped. -
modifyOne
-
modifyOne
-
modifyRange
-
modifyRow
-
modifyRow
-
nonzeros
Description copied from interface:Access1DSimilar toAccess1D.elements()but avoids elements that are structurally known to be zero. (That does not eliminate all zero-values from this view.) With an arbitrary (dense) unstructured implementation theAccess1D.nonzeros()andAccess1D.elements()methods do the same thing! Only some specific implementations are able to actually exploit structure/sparsity to view fewer elements. -
regionByTransposing
- Specified by:
regionByTransposingin interfaceTransformableRegion<N extends Comparable<N>>- Overrides:
regionByTransposingin classSubregion2D<N extends Comparable<N>>- Returns:
- A transposed consumer region
-
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. -
rows
-
rows
-
rows
-
select
-
select
-
select
-
set
public void set(int index, byte value) -
set
public void set(int index, double value) -
set
public void set(int index, float value) -
set
public void set(int index, int value) -
set
public void set(int row, int col, byte value) -
set
public void set(int row, int col, double value) -
set
public void set(int row, int col, float value) -
set
public void set(int row, int col, int value) -
set
public void set(int row, int col, long value) -
set
public void set(int row, int col, short value) -
set
public void set(int index, long value) -
set
public void set(int index, short value) -
set
public void set(long index, byte value) -
set
-
set
public void set(long index, double value) -
set
public void set(long index, float value) -
set
public void set(long index, int value) -
set
public void set(long index, long value) -
set
public void set(long row, long col, byte value) -
set
-
set
public void set(long row, long col, double value) -
set
public void set(long row, long col, float value) -
set
public void set(long row, long col, int value) -
set
public void set(long row, long col, long value) -
set
public void set(long row, long col, short value) -
set
public void set(long index, short value) -
shortValue
public short shortValue(int index) -
shortValue
public short shortValue(int row, int col) -
shortValue
public short shortValue(long index) -
shortValue
public short shortValue(long row, long col) -
size
public int size()Description copied from interface:Structure2Dsize() == getRowDim() * getColDim() -
supplyTo
public void supplyTo(double[] receiver) -
toRawCopy1D
public double[] toRawCopy1D() -
toRawCopy2D
public double[][] toRawCopy2D()
-