java.lang.Object
org.ojalgo.matrix.store.RowsSupplier<N>
- All Implemented Interfaces:
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>,SparseStructure2D,Access1D<N>,Access1D.Aggregatable<N>,Access1D.Collectable<N,,Mutate1D> 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 RowsSupplier<N extends Comparable<N>>
extends Object
implements MatrixStore<N>, SparseStructure2D, Mutate2D.ModifiableReceiver<N>
Sparse rows – rows can be added and removed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRowsSupplier.SingleView<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.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>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.SortableNested 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.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 Comparable<N>>, ScalarOperation.Division<T, N extends Comparable<N>>, ScalarOperation.Multiplication<T, N extends Comparable<N>>, ScalarOperation.Subtraction<T, 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> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final PhysicalStore.Factory<N, ?> private final SparseArray.SparseFactory<N> private final List<SparseArray<N>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long row, long col, double addend) voidadd(long row, long col, Comparable<?> addend) addRow()(package private) SparseArray<N> addRow(SparseArray<N> rowToAdd) voidaddRows(int numberToAdd) longOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.intlongOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.voiddoCyclicFT(int from, Mutate1D row, int to, Access1D<?> column) Performs the row/column cyclic shifts required by the Forrest-Tomlin update algorithm as implemented in ojAlgo's own sparse LU decomposition.doubledoubleValue(int row, int col) Extracts one element of this matrix as a double.voidexchangeColumns(long colA, long colB) voidexchangeRows(long rowA, long rowB) get()get(int row, int col) intgetRow(int index) intvoidmodifyAny(Transformation2D<N> modifier) voidmodifyOne(long row, long col, UnaryFunction<N> modifier) physical()voidputLast(int row, int col, double value) Efficiently appends a new nonzero element to the end of the specified row.removeRow(int index) voidreset()Reset this mutable structure to some standard (all zeros) initial state.rows()rows(int... rows) A selection (re-ordering) of rows.selectRows(int[] indices) voidset(int row, int col, double value) voidset(long row, long col, Comparable<?> value) sliceRow(long row) voidsupplyTo(TransformableRegion<N> receiver) toCSC()toCSR()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, asList, axpy, dot, select, supplyTo, toList, toRawCopy1DMethods inherited from interface org.ojalgo.structure.Access1D.Collectable
collectMethods inherited from interface org.ojalgo.structure.Access1D.Visitable
visitAll, visitRangeMethods 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, toRawCopy2DMethods inherited from interface org.ojalgo.structure.Access2D.Aggregatable
aggregateColumn, aggregateDiagonal, aggregateRow, reduceColumns, reduceRowsMethods inherited from interface org.ojalgo.structure.Access2D.Collectable
collectMethods inherited from interface org.ojalgo.structure.Access2D.Sliceable
sliceColumn, sliceDiagonalMethods inherited from interface org.ojalgo.structure.Access2D.Visitable
visitColumn, visitColumn, visitDiagonal, visitDiagonal, visitOne, visitRow, visitRowMethods inherited from interface org.ojalgo.matrix.store.ElementsSupplier
onAny, onColumns, onColumns, onMatching, onMatching, onRows, onRowsMethods 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, supplyTo, symmetric, toScalar, transpose, triangular, tridiagonal, visitOneMethods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillAll, fillAll, fillCompatible, fillMatching, fillMatching, fillMatching, fillRange, fillRangeMethods inherited from interface org.ojalgo.structure.Mutate1D.Modifiable
modifyAll, modifyMatching, modifyMatching, modifyRangeMethods 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, setMethods 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, fillRowMethods inherited from interface org.ojalgo.structure.Mutate2D.Modifiable
add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, modifyColumn, modifyColumn, modifyDiagonal, modifyDiagonal, modifyMatchingInColumns, modifyMatchingInColumns, modifyMatchingInRows, modifyMatchingInRows, modifyOne, modifyRow, modifyRowMethods inherited from interface org.ojalgo.structure.Mutate2D.ModifiableReceiver
modifyCompatible, modifyCompatibleMethods inherited from interface org.ojalgo.structure.Mutate2D.Receiver
accept, isAcceptableMethods inherited from interface org.ojalgo.structure.Operate2D
onAll, onAll, onAll, onAll, onAll, onCompatible, onCompatibleMethods inherited from interface org.ojalgo.algebra.ScalarOperation.Addition
addMethods inherited from interface org.ojalgo.algebra.ScalarOperation.Division
divideMethods inherited from interface org.ojalgo.algebra.ScalarOperation.Multiplication
multiplyMethods inherited from interface org.ojalgo.algebra.ScalarOperation.Subtraction
subtractMethods inherited from interface org.ojalgo.matrix.store.SparseStructure2D
densityMethods inherited from interface org.ojalgo.structure.Structure2D
count, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Field Details
-
myColumnsCount
private final int myColumnsCount -
myPhysicalStoreFactory
-
myRowFactory
-
myRows
-
-
Constructor Details
-
RowsSupplier
RowsSupplier(PhysicalStore.Factory<N, ?> factory, int numberOfColumns)
-
-
Method Details
-
add
- Specified by:
addin interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
add
public void add(long row, long col, double addend) - Specified by:
addin interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
addRow
-
addRows
public void addRows(int numberToAdd) -
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
-
countNonzeros
public int countNonzeros()- Specified by:
countNonzerosin interfaceSparseStructure2D
-
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
-
doCyclicFT
Performs the row/column cyclic shifts required by the Forrest-Tomlin update algorithm as implemented in ojAlgo's own sparse LU decomposition. This method is not intended for any other use case.- Parameters:
from- the row index to start the cyclic shiftrow- a Mutate1D to receive the removed row's values (shifted left by one column)to- the row index to end the cyclic shiftcolumn- an Access1D providing the new column values
-
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 Comparable<N>>- Specified by:
doubleValuein interfaceMatrixStore<N extends 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
-
get
- Specified by:
getin interfaceMatrixStore<N extends Comparable<N>>
-
get
- Specified by:
getin interfaceMatrixStore<N extends Comparable<N>>
-
getColDim
public int getColDim()- Specified by:
getColDimin interfaceStructure2D- Returns:
- The number of columns
-
getRow
-
getRowDim
public int getRowDim()- Specified by:
getRowDimin interfaceStructure2D- Returns:
- The number of rows
-
modifyAny
- Specified by:
modifyAnyin interfaceMutate2D.ModifiableReceiver<N extends Comparable<N>>
-
modifyOne
- Specified by:
modifyOnein interfaceMutate2D.Modifiable<N extends Comparable<N>>
-
physical
- Specified by:
physicalin interfaceMatrixStore<N extends Comparable<N>>
-
putLast
public void putLast(int row, int col, double value) Efficiently appends a new nonzero element to the end of the specified row.This method assumes that the supplied
colis strictly greater than all existing column indices in the specified row. No search is performed; the value is simply appended. If the ascending order of column indices is broken, future behavior is unspecified. If the value is zero, nothing is stored.- Parameters:
row- the row to which the value should be appendedcol- the column index (must be after all existing column indices in the row)value- the value to insert (only nonzero values are actually stored)
-
removeRow
-
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
- Specified by:
rowsin interfaceAccess2D<N extends Comparable<N>>
-
rows
Description copied from interface:MatrixStoreA 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.- Specified by:
rowsin interfaceAccess2D<N extends Comparable<N>>- Specified by:
rowsin interfaceMatrixStore<N extends Comparable<N>>- Specified by:
rowsin interfaceStructure2D.Logical<Access2D<N extends Comparable<N>>,MatrixStore<N extends Comparable<N>>>
-
selectRows
-
set
public void set(int row, int col, double value) -
set
-
sliceRow
- Specified by:
sliceRowin interfaceAccess2D.Sliceable<N extends Comparable<N>>
-
supplyTo
- Specified by:
supplyToin interfaceAccess2D.Collectable<N extends Comparable<N>,TransformableRegion<N extends Comparable<N>>> - Specified by:
supplyToin interfaceMatrixStore<N extends Comparable<N>>
-
toCSC
- Specified by:
toCSCin interfaceSparseStructure2D
-
toCSR
- Specified by:
toCSRin interfaceSparseStructure2D
-
toString
-
addRow
-