Package org.ojalgo.matrix.store
Class SparseStore<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.store.AbstractStore<N>
-
- org.ojalgo.matrix.store.FactoryStore<N>
-
- org.ojalgo.matrix.store.SparseStore<N>
-
- All Implemented Interfaces:
java.util.function.Consumer<Access2D<?>>
,Group
,Group.Additive<MatrixStore<N>>
,NormedVectorSpace<MatrixStore<N>,N>
,Operation
,Operation.Addition<MatrixStore<N>>
,Operation.Multiplication<MatrixStore<N>>
,Operation.Subtraction<MatrixStore<N>>
,ScalarOperation
,ScalarOperation.Addition<MatrixStore<N>,N>
,ScalarOperation.Division<MatrixStore<N>,N>
,ScalarOperation.Multiplication<MatrixStore<N>,N>
,ScalarOperation.Subtraction<MatrixStore<N>,N>
,VectorSpace<MatrixStore<N>,N>
,Matrix2D<N,MatrixStore<N>>
,ElementsSupplier<N>
,MatrixStore<N>
,TransformableRegion<N>
,Access1D<N>
,Access1D.Aggregatable<N>
,Access1D.Sliceable<N>
,Access1D.Visitable<N>
,Access2D<N>
,Access2D.Aggregatable<N>
,Access2D.Collectable<N,TransformableRegion<N>>
,Access2D.Sliceable<N>
,Access2D.Visitable<N>
,Mutate1D
,Mutate1D.Fillable<N>
,Mutate1D.Modifiable<N>
,Mutate2D
,Mutate2D.Exchangeable
,Mutate2D.Fillable<N>
,Mutate2D.Modifiable<N>
,Mutate2D.ModifiableReceiver<N>
,Mutate2D.Receiver<N>
,Operate2D<N,ElementsSupplier<N>>
,Structure1D
,Structure2D
,Structure2D.Logical<Access2D<N>,MatrixStore<N>>
,Structure2D.ReducibleTo1D<ElementsSupplier<N>>
public final class SparseStore<N extends java.lang.Comparable<N>> extends FactoryStore<N> implements TransformableRegion<N>
A sparse matrix (this implementation) is not thread safe. Mutating the matrix (in particular creating new/more non-zero elements) from multiple threads will result in unpredictable behaviour (even if the threads update different elements). To mutate the matrix in a concurrent/multi-threaded environment you need to do one of the following:- Use the
TransformableRegion.synchronised()
method to create a synchronised wrapper of the matrix. - Use the
SparseStore.Builder
to build the matrix.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SparseStore.Builder<N extends java.lang.Comparable<N>>
May be a preferable way to build a sparse matrix if: You don't know the number of nonzero elements in advance.static class
SparseStore.Factory<N extends java.lang.Comparable<N>>
-
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.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>
-
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.algebra.Operation
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.ScalarOperation
ScalarOperation.Addition<T,N extends java.lang.Comparable<N>>, ScalarOperation.Division<T,N extends java.lang.Comparable<N>>, ScalarOperation.Multiplication<T,N extends java.lang.Comparable<N>>, ScalarOperation.Subtraction<T,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>
-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.TransformableRegion
TransformableRegion.FillByMultiplying<N extends java.lang.Comparable<N>>
-
-
Field Summary
Fields Modifier and Type Field Description static SparseStore.Factory<ComplexNumber>
C128
static SparseStore.Factory<Quaternion>
H256
private SparseArray<N>
myElements
private int[]
myFirsts
private int[]
myLimits
private TransformableRegion.FillByMultiplying<N>
myMultiplier
static SparseStore.Factory<RationalNumber>
Q128
static SparseStore.Factory<java.lang.Double>
R032
static SparseStore.Factory<java.lang.Double>
R064
static SparseStore.Factory<Quadruple>
R128
-
Constructor Summary
Constructors Constructor Description SparseStore(PhysicalStore.Factory<N,?> factory, int nbRows, int nbCols, java.util.function.IntBinaryOperator initial)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long row, long col, double addend)
void
add(long row, long col, java.lang.Comparable<?> addend)
private static <N extends Scalar<N>>
voiddoGenericColumnAXPY(SparseArray<N> elements, long colX, long colY, N a, TransformableRegion<N> y)
private static void
doPrimitiveColumnAXPY(SparseArray<java.lang.Double> elements, long colX, long colY, double a, TransformableRegion<java.lang.Double> y)
double
doubleValue(int row, int col)
Extracts one element of this matrix as a double.boolean
equals(java.lang.Object obj)
static <N extends java.lang.Comparable<N>>
SparseStore.Factory<N>factory(PhysicalStore.Factory<N,?> physicalFactory)
void
fillByMultiplying(Access1D<N> left, Access1D<N> right)
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()
.N
get(int row, int col)
(package private) SparseArray<N>
getElements()
int
hashCode()
long
indexOfLargest()
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
.void
modifyAll(UnaryFunction<N> modifier)
void
modifyMatching(BinaryFunction<N> function, Access1D<N> right)
void
modifyMatching(Access1D<N> left, BinaryFunction<N> function)
void
modifyOne(long row, long col, UnaryFunction<N> modifier)
MatrixStore<N>
multiply(double scalar)
MatrixStore<N>
multiply(N scalar)
MatrixStore<N>
multiply(MatrixStore<N> right)
(package private) static <N extends java.lang.Comparable<N>>
voidmultiply(SparseStore<N> left, SparseStore<N> right, TransformableRegion<N> target)
void
multiply(Access1D<N> right, TransformableRegion<N> target)
N
multiplyBoth(Access1D<N> leftAndRight)
Assumes [leftAndRight] is a vector and will calulate [leftAndRight]H[this][leftAndRight]ElementView2D<N,?>
nonzeros()
Similar toAccess1D.elements()
but avoids elements that are structurally known to be zero.ElementsSupplier<N>
premultiply(Access1D<N> left)
Thepremultiply
method differs frommultiply
in 3 ways: The matrix positions are swapped - left/right. It does NOT return a MatrixStore but an ElementsSupplier instead. It accepts an Access1D as the argument left matrix.void
reduceColumns(Aggregator aggregator, Mutate1D receiver)
void
reduceRows(Aggregator aggregator, Mutate1D receiver)
TransformableRegion<N>
regionByColumns(int... columns)
TransformableRegion<N>
regionByLimits(int rowLimit, int columnLimit)
TransformableRegion<N>
regionByOffsets(int rowOffset, int columnOffset)
TransformableRegion<N>
regionByRows(int... rows)
TransformableRegion<N>
regionByTransposing()
void
reset()
Reset this mutable structure to some standard (all zeros) initial state.void
set(int row, int col, double value)
void
set(long row, long col, java.lang.Comparable<?> value)
void
supplyTo(TransformableRegion<N> receiver)
(package private) void
updateNonZeros(int row, int col)
private void
updateNonZeros(long row, long col)
void
visitColumn(long row, long col, VoidFunction<N> visitor)
void
visitRow(long row, long col, VoidFunction<N> visitor)
-
Methods inherited from class org.ojalgo.matrix.store.FactoryStore
one, physical, zero
-
Methods inherited from class org.ojalgo.matrix.store.AbstractStore
buildColumn, buildColumn, buildColumn, buildRow, buildRow, buildRow, cast, countColumns, countRows, getColDim, getComponentType, getMaxDim, getMinDim, getRowDim, isPrimitive, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, 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.Access1D.Visitable
visitAll, visitRange
-
Methods inherited from interface org.ojalgo.structure.Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, byteValue, byteValue, columns, doubleValue, doubleValue, doubleValue, elements, floatValue, floatValue, floatValue, floatValue, get, intValue, intValue, intValue, intValue, longValue, longValue, longValue, longValue, rows, shortValue, shortValue, shortValue, shortValue, toRawCopy2D
-
Methods inherited from interface org.ojalgo.structure.Access2D.Aggregatable
aggregateColumn, aggregateDiagonal, aggregateRow
-
Methods inherited from interface org.ojalgo.structure.Access2D.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Access2D.Sliceable
sliceColumn, sliceDiagonal, sliceRow
-
Methods inherited from interface org.ojalgo.structure.Access2D.Visitable
visitColumn, visitDiagonal, visitDiagonal, visitOne, visitRow
-
Methods inherited from interface org.ojalgo.matrix.store.ElementsSupplier
onAny, onColumns, onColumns, onMatching, onMatching, onRows, onRows
-
Methods inherited from interface org.ojalgo.matrix.store.MatrixStore
above, above, above, add, add, add, aggregateAll, aggregateColumn, aggregateDiagonal, aggregateRange, aggregateRow, below, below, below, bidiagonal, column, column, columns, columns, conjugate, copy, diagonal, diagonally, divide, divide, equals, get, get, hermitian, hessenberg, isHermitian, isNormal, isSmall, isSmall, left, left, left, limits, logical, negate, norm, offsets, onAll, operate, power, reduceColumns, reduceRows, repeat, right, right, right, row, row, rows, rows, select, select, signum, sliceColumn, sliceDiagonal, sliceRange, sliceRow, subtract, subtract, subtract, superimpose, superimpose, symmetric, toScalar, transpose, triangular, tridiagonal, visitOne
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillAll, fillAll, fillCompatible, fillMatching, fillMatching, fillMatching, fillRange, fillRange
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Modifiable
modifyRange
-
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, set, set
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.Fillable
fillColumn, fillColumn, fillColumn, fillColumn, fillColumn, fillColumn, fillCompatible, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillRow, fillRow, fillRow, fillRow, fillRow, fillRow
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.Modifiable
add, add, add, add, add, add, add, add, add, add, add, add, modifyColumn, modifyColumn, modifyDiagonal, modifyDiagonal, modifyMatchingInColumns, modifyMatchingInColumns, modifyMatchingInRows, modifyMatchingInRows, modifyOne, modifyRow, modifyRow
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.ModifiableReceiver
modifyCompatible, modifyCompatible
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.Receiver
accept, isAcceptable
-
Methods inherited from interface org.ojalgo.structure.Operate2D
onAll, onAll, onAll, onAll, onAll, onCompatible, onCompatible
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Addition
add
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Division
divide
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Multiplication
multiply
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Subtraction
subtract
-
Methods inherited from interface org.ojalgo.structure.Structure2D
count, countColumns, countRows, getColDim, getMaxDim, getMinDim, getRowDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, size
-
Methods inherited from interface org.ojalgo.matrix.store.TransformableRegion
exchangeColumns, exchangeRows, modifyAny, synchronised
-
-
-
-
Field Detail
-
C128
public static final SparseStore.Factory<ComplexNumber> C128
-
H256
public static final SparseStore.Factory<Quaternion> H256
-
Q128
public static final SparseStore.Factory<RationalNumber> Q128
-
R032
public static final SparseStore.Factory<java.lang.Double> R032
-
R064
public static final SparseStore.Factory<java.lang.Double> R064
-
R128
public static final SparseStore.Factory<Quadruple> R128
-
myElements
private final SparseArray<N extends java.lang.Comparable<N>> myElements
-
myFirsts
private final int[] myFirsts
-
myLimits
private final int[] myLimits
-
myMultiplier
private final TransformableRegion.FillByMultiplying<N extends java.lang.Comparable<N>> myMultiplier
-
-
Constructor Detail
-
SparseStore
SparseStore(PhysicalStore.Factory<N,?> factory, int nbRows, int nbCols, java.util.function.IntBinaryOperator initial)
-
-
Method Detail
-
factory
public static <N extends java.lang.Comparable<N>> SparseStore.Factory<N> factory(PhysicalStore.Factory<N,?> physicalFactory)
-
doGenericColumnAXPY
private static <N extends Scalar<N>> void doGenericColumnAXPY(SparseArray<N> elements, long colX, long colY, N a, TransformableRegion<N> y)
-
doPrimitiveColumnAXPY
private static void doPrimitiveColumnAXPY(SparseArray<java.lang.Double> elements, long colX, long colY, double a, TransformableRegion<java.lang.Double> y)
-
multiply
static <N extends java.lang.Comparable<N>> void multiply(SparseStore<N> left, SparseStore<N> right, TransformableRegion<N> target)
-
add
public void add(long row, long col, java.lang.Comparable<?> addend)
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, double addend)
- Specified by:
add
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
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>>
- Specified by:
doubleValue
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Parameters:
row
- A row index.col
- A column index.- Returns:
- One matrix element
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classFactoryStore<N extends java.lang.Comparable<N>>
-
fillByMultiplying
public void fillByMultiplying(Access1D<N> left, Access1D<N> right)
- Specified by:
fillByMultiplying
in interfaceTransformableRegion<N extends java.lang.Comparable<N>>
-
firstInColumn
public int firstInColumn(int col)
Description copied from interface:Structure2D
The default value is simply0
, and if all elements are zeros thenthis.countRows()
.- Specified by:
firstInColumn
in interfaceStructure2D
- 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()
.- Specified by:
firstInRow
in interfaceStructure2D
- Returns:
- The column index of the first non-zero element in the specified row
-
get
public N get(int row, int col)
- Specified by:
get
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classFactoryStore<N extends java.lang.Comparable<N>>
-
indexOfLargest
public long indexOfLargest()
- Specified by:
indexOfLargest
in interfaceAccess1D.Aggregatable<N extends java.lang.Comparable<N>>
- Specified by:
indexOfLargest
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
limitOfColumn
public int limitOfColumn(int col)
Description copied from interface:Structure2D
The default value is simplythis.countRows()
, and if all elements are zeros then0
.- Specified by:
limitOfColumn
in interfaceStructure2D
- Overrides:
limitOfColumn
in classAbstractStore<N extends java.lang.Comparable<N>>
- 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
.- Specified by:
limitOfRow
in interfaceStructure2D
- Overrides:
limitOfRow
in classAbstractStore<N extends java.lang.Comparable<N>>
- Returns:
- The column index of the first zero element, after all non-zeros, in the specified row (index of the last non-zero + 1)
-
modifyAll
public void modifyAll(UnaryFunction<N> modifier)
- Specified by:
modifyAll
in interfaceMutate1D.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>>
-
modifyOne
public void modifyOne(long row, long col, UnaryFunction<N> modifier)
- Specified by:
modifyOne
in interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
multiply
public void multiply(Access1D<N> right, TransformableRegion<N> target)
- Specified by:
multiply
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
multiply
public MatrixStore<N> multiply(double scalar)
- Specified by:
multiply
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixStore<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
- Returns:
this * scalarMultiplicand
.
-
multiply
public MatrixStore<N> multiply(MatrixStore<N> right)
- Specified by:
multiply
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Specified by:
multiply
in interfaceOperation.Multiplication<N extends java.lang.Comparable<N>>
- Parameters:
right
- The multiplicand- Returns:
this * multiplicand
.
-
multiply
public MatrixStore<N> multiply(N scalar)
- Specified by:
multiply
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixStore<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
- Returns:
this * multiplicand
.
-
multiplyBoth
public N multiplyBoth(Access1D<N> leftAndRight)
Description copied from interface:MatrixStore
Assumes [leftAndRight] is a vector and will calulate [leftAndRight]H[this][leftAndRight]- Specified by:
multiplyBoth
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Overrides:
multiplyBoth
in classAbstractStore<N extends java.lang.Comparable<N>>
- Parameters:
leftAndRight
- The argument vector- Returns:
- A scalar (extracted from the resulting 1 x 1 matrix)
-
nonzeros
public ElementView2D<N,?> 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.
-
premultiply
public ElementsSupplier<N> premultiply(Access1D<N> left)
Description copied from interface:MatrixStore
Thepremultiply
method differs frommultiply
in 3 ways:- The matrix positions are swapped - left/right.
- It does NOT return a MatrixStore but an ElementsSupplier instead.
- It accepts an Access1D as the argument left matrix.
- Specified by:
premultiply
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Parameters:
left
- The left matrix- Returns:
- The matrix product
-
reduceColumns
public void reduceColumns(Aggregator aggregator, Mutate1D receiver)
- Specified by:
reduceColumns
in interfaceAccess2D.Aggregatable<N extends java.lang.Comparable<N>>
-
reduceRows
public void reduceRows(Aggregator aggregator, Mutate1D receiver)
- Specified by:
reduceRows
in interfaceAccess2D.Aggregatable<N extends java.lang.Comparable<N>>
-
regionByColumns
public TransformableRegion<N> regionByColumns(int... columns)
- Specified by:
regionByColumns
in interfaceTransformableRegion<N extends java.lang.Comparable<N>>
- Returns:
- A consumer (sub)region
-
regionByLimits
public TransformableRegion<N> regionByLimits(int rowLimit, int columnLimit)
- Specified by:
regionByLimits
in interfaceTransformableRegion<N extends java.lang.Comparable<N>>
- Returns:
- A consumer (sub)region
-
regionByOffsets
public TransformableRegion<N> regionByOffsets(int rowOffset, int columnOffset)
- Specified by:
regionByOffsets
in interfaceTransformableRegion<N extends java.lang.Comparable<N>>
- Returns:
- A consumer (sub)region
-
regionByRows
public TransformableRegion<N> regionByRows(int... rows)
- Specified by:
regionByRows
in interfaceTransformableRegion<N extends java.lang.Comparable<N>>
- Returns:
- A consumer (sub)region
-
regionByTransposing
public TransformableRegion<N> regionByTransposing()
- Specified by:
regionByTransposing
in interfaceTransformableRegion<N extends java.lang.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.
-
set
public void set(long row, long col, java.lang.Comparable<?> value)
-
supplyTo
public void supplyTo(TransformableRegion<N> receiver)
- Specified by:
supplyTo
in interfaceAccess2D.Collectable<N extends java.lang.Comparable<N>,TransformableRegion<N extends java.lang.Comparable<N>>>
- Specified by:
supplyTo
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
visitColumn
public void visitColumn(long row, long col, VoidFunction<N> visitor)
- Specified by:
visitColumn
in interfaceAccess2D.Visitable<N extends java.lang.Comparable<N>>
-
visitRow
public void visitRow(long row, long col, VoidFunction<N> visitor)
- Specified by:
visitRow
in interfaceAccess2D.Visitable<N extends java.lang.Comparable<N>>
-
updateNonZeros
private void updateNonZeros(long row, long col)
-
getElements
SparseArray<N> getElements()
-
updateNonZeros
void updateNonZeros(int row, int col)
-
-