Module ojalgo
Package org.ojalgo.matrix.store
Class ColumnsSupplier<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.store.ColumnsSupplier<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>,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 ColumnsSupplier<N extends java.lang.Comparable<N>> extends java.lang.Object implements MatrixStore<N>, SparseStructure2D, Mutate2D.ModifiableReceiver<N>
Sparse columns – columns can be added and removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classColumnsSupplier.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.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>
-
-
Field Summary
Fields Modifier and Type Field Description private SparseArray.SparseFactory<N>myColumnFactoryprivate java.util.List<SparseArray<N>>myColumnsprivate PhysicalStore.Factory<N,?>myPhysicalStoreFactoryprivate intmyRowsCount
-
Constructor Summary
Constructors Constructor Description ColumnsSupplier(PhysicalStore.Factory<N,?> factory, int numberOfRows)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int row, int col, double addend)voidadd(long row, long col, double addend)voidadd(long row, long col, java.lang.Comparable<?> addend)SparseArray<N>addColumn()(package private) SparseArray<N>addColumn(SparseArray<N> columnToAdd)voidaddColumns(int numberToAdd)ColumnsSupplier.SingleView<N>columns()MatrixStore<N>columns(int... columns)A selection (re-ordering) of columns.longcountColumns()Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.intcountNonzeros()longcountRows()Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.doubledoubleValue(int row, int col)Extracts one element of this matrix as a double.voidexchangeColumns(long colA, long colB)voidexchangeRows(long rowA, long rowB)PhysicalStore<N>get()Nget(int row, int col)intgetColDim()SparseArray<N>getColumn(int index)intgetRowDim()voidmodifyAny(Transformation2D<N> modifier)voidmodifyOne(long row, long col, UnaryFunction<N> modifier)PhysicalStore.Factory<N,?>physical()voidputLast(int row, int col, double value)Efficiently appends a new nonzero element to the end of the specified column.Access1D<N>removeColumn(int index)voidreset()Reset this mutable structure to some standard (all zeros) initial state.ColumnsSupplier<N>selectColumns(int[] indices)voidset(int row, int col, double value)voidset(long row, long col, java.lang.Comparable<?> value)SparseArray<N>sliceColumn(long col)voidsupplyTo(TransformableRegion<N> receiver)R064CSCtoCSC()(package private) R064CSCtoCSC(int nbRows, int nbCols, int nbNz)R064CSRtoCSR()java.lang.StringtoString()-
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, asList, axpy, dot, select, supplyTo, toList, toRawCopy1D
-
Methods inherited from interface org.ojalgo.structure.Access1D.Collectable
collect
-
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, doubleValue, doubleValue, doubleValue, elements, floatValue, floatValue, floatValue, floatValue, get, intValue, intValue, intValue, intValue, longValue, longValue, longValue, longValue, nonzeros, rows, 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
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, 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, rows, select, select, signum, sliceColumn, sliceDiagonal, sliceRange, sliceRow, subtract, subtract, subtract, superimpose, superimpose, supplyTo, symmetric, toScalar, transpose, triangular, tridiagonal, visitOne
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillAll, fillAll, fillCompatible, fillMatching, fillMatching, fillMatching, fillMatching, fillRange, fillRange
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Modifiable
add, add, add, add, add, modifyAll, modifyMatching, modifyMatching, 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, 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.matrix.store.SparseStructure2D
density
-
Methods inherited from interface org.ojalgo.structure.Structure2D
count, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
myColumnFactory
private final SparseArray.SparseFactory<N extends java.lang.Comparable<N>> myColumnFactory
-
myColumns
private final java.util.List<SparseArray<N extends java.lang.Comparable<N>>> myColumns
-
myPhysicalStoreFactory
private final PhysicalStore.Factory<N extends java.lang.Comparable<N>,?> myPhysicalStoreFactory
-
myRowsCount
private final int myRowsCount
-
-
Constructor Detail
-
ColumnsSupplier
ColumnsSupplier(PhysicalStore.Factory<N,?> factory, int numberOfRows)
-
-
Method Detail
-
add
public void add(int row, int col, double addend)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, java.lang.Comparable<?> addend)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long row, long col, double addend)- Specified by:
addin interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
addColumn
public SparseArray<N> addColumn()
-
addColumns
public void addColumns(int numberToAdd)
-
columns
public ColumnsSupplier.SingleView<N> columns()
-
columns
public MatrixStore<N> columns(int... columns)
Description copied from interface:MatrixStoreA selection (re-ordering) of columns. Note that it's ok to reference the same base column more than once, and any negative column reference/index will translate to a column of zeros. The number of columns in the resulting matrix is the same as the number of elements in the columns index array.- Specified by:
columnsin interfaceAccess2D<N extends java.lang.Comparable<N>>- Specified by:
columnsin interfaceMatrixStore<N extends java.lang.Comparable<N>>- Specified by:
columnsin interfaceStructure2D.Logical<Access2D<N extends java.lang.Comparable<N>>,MatrixStore<N extends java.lang.Comparable<N>>>
-
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
-
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 java.lang.Comparable<N>>- Specified by:
doubleValuein interfaceMatrixStore<N extends java.lang.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
public PhysicalStore<N> get()
- Specified by:
getin interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
get
public N get(int row, int col)
- Specified by:
getin interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
getColDim
public int getColDim()
- Specified by:
getColDimin interfaceStructure2D- Returns:
- The number of columns
-
getColumn
public SparseArray<N> getColumn(int index)
-
getRowDim
public int getRowDim()
- Specified by:
getRowDimin interfaceStructure2D- Returns:
- The number of rows
-
modifyAny
public void modifyAny(Transformation2D<N> modifier)
- Specified by:
modifyAnyin interfaceMutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long row, long col, UnaryFunction<N> modifier)- Specified by:
modifyOnein interfaceMutate2D.Modifiable<N extends java.lang.Comparable<N>>
-
physical
public PhysicalStore.Factory<N,?> physical()
- Specified by:
physicalin interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
putLast
public void putLast(int row, int col, double value)Efficiently appends a new nonzero element to the end of the specified column.This method assumes that the supplied
rowis strictly greater than all existing row indices in the specified column. No search is performed; the value is simply appended. If the ascending order of row indices is broken, future behavior is unspecified. If the value is zero, nothing is stored.- Parameters:
row- the row index (must be after all existing row indices in the column)col- the column to which the value should be appendedvalue- the value to insert (only nonzero values are actually stored)
-
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.
-
selectColumns
public ColumnsSupplier<N> selectColumns(int[] indices)
-
set
public void set(long row, long col, java.lang.Comparable<?> value)
-
sliceColumn
public SparseArray<N> sliceColumn(long col)
- Specified by:
sliceColumnin interfaceAccess2D.Sliceable<N extends java.lang.Comparable<N>>
-
supplyTo
public void supplyTo(TransformableRegion<N> receiver)
- Specified by:
supplyToin interfaceAccess2D.Collectable<N extends java.lang.Comparable<N>,TransformableRegion<N extends java.lang.Comparable<N>>>- Specified by:
supplyToin interfaceMatrixStore<N extends java.lang.Comparable<N>>
-
toCSC
public R064CSC toCSC()
- Specified by:
toCSCin interfaceSparseStructure2D
-
toCSR
public R064CSR toCSR()
- Specified by:
toCSRin interfaceSparseStructure2D
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addColumn
SparseArray<N> addColumn(SparseArray<N> columnToAdd)
-
toCSC
R064CSC toCSC(int nbRows, int nbCols, int nbNz)
-
-