Package org.ojalgo.matrix.store
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 org.ojalgo.matrix.store.Subregion2D
Subregion2D.ColumnsRegion<N extends Comparable<N>>, Subregion2D.LimitRegion<N extends Comparable<N>>, Subregion2D.OffsetRegion<N extends Comparable<N>>, Subregion2D.RowsRegion<N extends Comparable<N>>, Subregion2D.SynchronizedRegion<N extends Comparable<N>>, Subregion2D.TransposedRegion<N extends Comparable<N>>, Subregion2D.WrapperRegion<N extends Comparable<N>>
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> Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.TransformableRegion
TransformableRegion.FillByMultiplying<N extends Comparable<N>>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(long index, byte addend) void
add
(long index, double addend) void
add
(long index, float addend) void
add
(long index, int addend) void
add
(long index, long addend) void
add
(long row, long col, byte addend) void
add
(long row, long col, double addend) void
add
(long row, long col, float addend) void
add
(long row, long col, int addend) void
add
(long row, long col, long addend) void
add
(long row, long col, short addend) void
add
(long row, long col, Comparable<?> addend) void
add
(long index, short addend) void
add
(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) void
axpy
(double a, Mutate1D.Modifiable<?> y) Will calculate y = y + a x, will add "a" times "this" to "y"byte
byteValue
(int index) byte
byteValue
(int row, int col) byte
byteValue
(long index) byte
byteValue
(long row, long col) columns()
columns
(int... columns) columns
(long... columns) 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
Will calculate and return the dot product of this 1D-structure and another input 1D-vector.double
doubleValue
(int index) double
doubleValue
(int row, int col) Extracts one element of this matrix as a double.double
doubleValue
(long index) double
doubleValue
(long row, long col) ElementView2D
<N, ?> elements()
Returns an Iterable of ElementView1D.void
exchangeColumns
(long colA, long colB) void
exchangeRows
(long rowA, long rowB) void
void
fillAll
(NullaryFunction<?> supplier) void
fillColumn
(long row, long col, 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
fillCompatible
(Access1D<N> left, BinaryFunction<N> operator, Access1D<N> right) void
fillCompatible
(Access2D<N> left, BinaryFunction<N> operator, Access2D<N> right) 'this' needs to be of a size compatible with the 'left' and 'right' matrices.void
fillDiagonal
(long row, long col, 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
int
firstInColumn
(int col) The default value is simply0
, and if all elements are zeros thenthis.countRows()
.int
firstInRow
(int row) The default value is simply0
, and if all elements are zeros thenthis.countColumns()
.float
floatValue
(int index) float
floatValue
(int row, int col) float
floatValue
(long index) float
floatValue
(long row, long col) get
(long index) get
(long row, long col) int
int
int
int
int
intValue
(int index) int
intValue
(int row, int col) int
intValue
(long index) int
intValue
(long row, long col) boolean
isAcceptable
(Structure2D supplier) boolean
isEmpty()
2D data structures are either square, tall, fat or empty.boolean
isFat()
2D data structures are either square, tall, fat or empty.boolean
isScalar()
boolean
isSquare()
2D data structures are either square, tall, fat or empty.boolean
isTall()
2D data structures are either square, tall, fat or empty.boolean
isVector()
int
limitOfColumn
(int col) The default value is simplythis.countRows()
, and if all elements are zeros then0
.int
limitOfRow
(int row) The default value is simplythis.countColumns()
, and if all elements are zeros then0
.long
longValue
(int index) long
longValue
(int row, int col) long
longValue
(long index) long
longValue
(long row, long col) 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) ElementView2D
<N, ?> nonzeros()
Similar toAccess1D.elements()
but avoids elements that are structurally known to be zero.void
reset()
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.void
set
(int index, byte value) void
set
(int index, double value) void
set
(int index, float value) void
set
(int index, int value) void
set
(int row, int col, byte value) void
set
(int row, int col, double value) void
set
(int row, int col, float value) void
set
(int row, int col, int value) void
set
(int row, int col, long value) void
set
(int row, int col, short value) void
set
(int index, long value) void
set
(int index, short value) void
set
(long index, byte value) void
set
(long index, double value) void
set
(long index, float value) void
set
(long index, int value) void
set
(long index, long value) void
set
(long row, long col, byte value) void
set
(long row, long col, double value) void
set
(long row, long col, float value) void
set
(long row, long col, int value) void
set
(long row, long col, long value) void
set
(long row, long col, short value) void
set
(long row, long col, Comparable<?> value) void
set
(long index, short value) void
set
(long index, Comparable<?> value) short
shortValue
(int index) short
shortValue
(int row, int col) short
shortValue
(long index) short
shortValue
(long row, long col) int
size()
size() == getRowDim() * getColDim()void
supplyTo
(double[] receiver) double[]
double[][]
Methods inherited from class org.ojalgo.matrix.store.Subregion2D
fillByMultiplying, findMultiplier, regionByColumns, regionByLimits, regionByOffsets, regionByRows, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ojalgo.matrix.store.TransformableRegion
synchronised
-
Field Details
-
myDelegate
-
-
Constructor Details
-
SynchronizedRegion
SynchronizedRegion(TransformableRegion<N> base)
-
-
Method Details
-
accept
-
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:Access1D
Will 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:Structure2D
count() == countRows() * countColumns() -
countColumns
public long countColumns()Description copied from interface:Structure2D
Only 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:Structure2D
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Returns:
- The number of rows
-
dot
Description copied from interface:Access1D
Will calculate and return the dot product of this 1D-structure and another input 1D-vector.- Parameters:
vector
- Another 1D-structure- Returns:
- The dot product
-
doubleValue
public double doubleValue(int index) -
doubleValue
public double doubleValue(int row, int col) Description copied from interface:Access2D
Extracts 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:Access1D
Returns 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.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>>
- Overrides:
fillMatching
in 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:Structure2D
The 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:Structure2D
The 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:Structure2D
2D 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:Structure2D
2D 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:Structure2D
2D 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:Structure2D
2D 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:Structure2D
The 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:Structure2D
The 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.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. -
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.Modifiable
Same asMutate2D.Modifiable.modifyMatchingInColumns(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped. -
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.) -
modifyMatchingInRows
Description copied from interface:Mutate2D.Modifiable
Same asMutate2D.Modifiable.modifyMatchingInRows(Access1D, BinaryFunction)
but with the arguments to the modifier function swapped. -
modifyOne
-
modifyOne
-
modifyRange
-
modifyRow
-
modifyRow
-
nonzeros
Description copied from interface:Access1D
Similar 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:
regionByTransposing
in interfaceTransformableRegion<N extends Comparable<N>>
- Overrides:
regionByTransposing
in classSubregion2D<N extends Comparable<N>>
- Returns:
- A transposed consumer region
-
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. -
rows
-
rows
-
rows
-
select
-
select
Description copied from interface:Access1D
Creates a view of the underlying data structure of only the selected elements. -
select
Description copied from interface:Access2D
Creates a view of the underlying data structure of only the selected elements. If either the rows or columns input arguments are null or empty arrays, then that transaltes to all rows and/or columns. -
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:Structure2D
size() == getRowDim() * getColDim() -
supplyTo
public void supplyTo(double[] receiver) -
toRawCopy1D
public double[] toRawCopy1D() -
toRawCopy2D
public double[][] toRawCopy2D()
-