Package org.ojalgo.matrix.store
Class RowsSupplier<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.store.RowsSupplier<N>
-
- All Implemented Interfaces:
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>
,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
,Mutate2D
,Operate2D<N,ElementsSupplier<N>>
,Structure1D
,Structure2D
,Structure2D.Logical<Access2D<N>,MatrixStore<N>>
,Structure2D.ReducibleTo1D<ElementsSupplier<N>>
public final class RowsSupplier<N extends java.lang.Comparable<N>> extends java.lang.Object implements MatrixStore<N>, Mutate2D
Sparse rows – rows can be added and removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RowsSupplier.SingleView<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.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>
-
-
Field Summary
Fields Modifier and Type Field Description private int
myColumnsCount
private PhysicalStore.Factory<N,?>
myPhysicalStoreFactory
private SparseArray.SparseFactory<N>
myRowFactory
private java.util.List<SparseArray<N>>
myRows
-
Constructor Summary
Constructors Constructor Description RowsSupplier(PhysicalStore.Factory<N,?> factory, int numberOfColumns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SparseArray<N>
addRow()
(package private) SparseArray<N>
addRow(SparseArray<N> rowToAdd)
void
addRows(int numberToAdd)
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.PhysicalStore<N>
get()
N
get(int row, int col)
int
getColDim()
SparseArray<N>
getRow(int index)
int
getRowDim()
PhysicalStore.Factory<N,?>
physical()
SparseArray<N>
removeRow(int index)
Access2D.RowView<N>
rows()
MatrixStore<N>
rows(int... rows)
A selection (re-ordering) of rows.RowsSupplier<N>
selectRows(int[] indices)
void
set(int row, int col, double value)
void
set(long row, long col, java.lang.Comparable<?> value)
void
supplyTo(TransformableRegion<N> receiver)
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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, nonzeros, shortValue, shortValue, shortValue, shortValue, toRawCopy2D
-
Methods inherited from interface org.ojalgo.structure.Access2D.Aggregatable
aggregateColumn, aggregateDiagonal, aggregateRow, reduceColumns, reduceRows
-
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, visitColumn, visitDiagonal, visitDiagonal, visitOne, visitRow, 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, hermitian, hessenberg, indexOfLargest, isHermitian, isNormal, isSmall, isSmall, left, left, left, limits, logical, multiply, multiply, multiply, multiply, multiplyBoth, negate, norm, offsets, onAll, operate, power, premultiply, reduceColumns, reduceRows, repeat, right, right, right, row, row, 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.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.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, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
myColumnsCount
private final int myColumnsCount
-
myPhysicalStoreFactory
private final PhysicalStore.Factory<N extends java.lang.Comparable<N>,?> myPhysicalStoreFactory
-
myRowFactory
private final SparseArray.SparseFactory<N extends java.lang.Comparable<N>> myRowFactory
-
myRows
private final java.util.List<SparseArray<N extends java.lang.Comparable<N>>> myRows
-
-
Constructor Detail
-
RowsSupplier
RowsSupplier(PhysicalStore.Factory<N,?> factory, int numberOfColumns)
-
-
Method Detail
-
addRow
public SparseArray<N> addRow()
-
addRows
public void addRows(int numberToAdd)
-
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>>
- Specified by:
doubleValue
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
- Parameters:
row
- A row index.col
- A column index.- Returns:
- One matrix element
-
get
public PhysicalStore<N> get()
- Specified by:
get
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
get
public N get(int row, int col)
- Specified by:
get
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
getColDim
public int getColDim()
- Specified by:
getColDim
in interfaceStructure2D
- Returns:
- The number of columns
-
getRow
public SparseArray<N> getRow(int index)
-
getRowDim
public int getRowDim()
- Specified by:
getRowDim
in interfaceStructure2D
- Returns:
- The number of rows
-
physical
public PhysicalStore.Factory<N,?> physical()
- Specified by:
physical
in interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
removeRow
public SparseArray<N> removeRow(int index)
-
rows
public Access2D.RowView<N> rows()
-
rows
public MatrixStore<N> rows(int... rows)
Description copied from interface:MatrixStore
A selection (re-ordering) of rows. Note that it's ok to reference the same base row more than once, and any negative row reference/index will translate to a row of zeros. The number of rows in the resulting matrix is the same as the number of elements in the rows index array.
-
selectRows
public RowsSupplier<N> selectRows(int[] indices)
-
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>>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
addRow
SparseArray<N> addRow(SparseArray<N> rowToAdd)
-
-