Package org.ojalgo.matrix.store
Class SparseStore.Builder<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.store.SparseStore.Builder<N>
-
- All Implemented Interfaces:
Factory2D.Builder<SparseStore<N>>
,Mutate1D
,Mutate2D
,Structure1D
,Structure2D
- Enclosing class:
- SparseStore<N extends java.lang.Comparable<N>>
public static final class SparseStore.Builder<N extends java.lang.Comparable<N>> extends java.lang.Object implements Factory2D.Builder<SparseStore<N>>
May be a preferable way to build a sparse matrix if:- You don't know the number of nonzero elements in advance.
- Setting elements in strictly increasing column major order is not possible.
- Multiple threads are used to set elements.
build()
method is called.
-
-
Nested Class Summary
-
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.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
myColDim
private java.util.Set<EntryPair.KeyedPrimitive<java.lang.Comparable<?>>>
myElements
private PhysicalStore.Factory<N,?>
myPhysicalFactory
private int
myRowDim
-
Constructor Summary
Constructors Constructor Description Builder(PhysicalStore.Factory<N,?> physicalFactory, int rowDim, int colDim)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SparseStore<N>
build()
int
getColDim()
int
getRowDim()
void
set(int row, int col, double value)
void
set(long row, long col, java.lang.Comparable<?> value)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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.Structure2D
count, countColumns, countRows, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
myColDim
private final int myColDim
-
myElements
private final java.util.Set<EntryPair.KeyedPrimitive<java.lang.Comparable<?>>> myElements
-
myPhysicalFactory
private final PhysicalStore.Factory<N extends java.lang.Comparable<N>,?> myPhysicalFactory
-
myRowDim
private final int myRowDim
-
-
Constructor Detail
-
Builder
Builder(PhysicalStore.Factory<N,?> physicalFactory, int rowDim, int colDim)
-
-
Method Detail
-
build
public SparseStore<N> build()
- Specified by:
build
in interfaceFactory2D.Builder<N extends java.lang.Comparable<N>>
-
getColDim
public int getColDim()
- Specified by:
getColDim
in interfaceStructure2D
- Returns:
- The number of columns
-
getRowDim
public int getRowDim()
- Specified by:
getRowDim
in interfaceStructure2D
- Returns:
- The number of rows
-
-