Class DataBatch
java.lang.Object
org.ojalgo.data.DataBatch
- All Implemented Interfaces:
Access1D<Double>, Access2D<Double>, Access2D.Collectable<Double, Mutate2D.Receiver<Double>>, Structure1D, Structure2D
public final class DataBatch
extends Object
implements Access2D<Double>, Access2D.Collectable<Double, Mutate2D.Receiver<Double>>
A reusable data batch. Build 2D data structures by adding a set of 1D structures treating then as rows. Use
it,
reset() and do it again.-
Nested Class Summary
Nested classes/interfaces inherited from interface Access2D
Access2D.Aggregatable<N>, Access2D.Collectable<N,R>, Access2D.ColumnView<N>, Access2D.ElementView<N>, Access2D.RowView<N>, Access2D.SelectionView<N>, Access2D.Sliceable<N>, Access2D.Visitable<N> Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S,B>, Structure1D.LongIndex, Structure1D.LoopCallback Nested classes/interfaces inherited from interface Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S,B>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R>, Structure2D.Reshapable, Structure2D.RowColumnKey<R, C>, Structure2D.RowColumnMapper<R, C> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddRows(Collection<? extends Access1D<Double>> rows) voidaddRowWithSingleUnit(int unitIndex) longAssumes all rows are of equal length and will only check the first.longOnly 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.static DataBatchfrom(Factory2D<? extends Mutate2D.ModifiableReceiver<Double>> factory, int batchSize, int dataNodes) With the batch size/capacity specified.get(long row, long col) intintbooleanisFull()intRemaining capacity / batch entries / number of rows.voidreset()voidsupplyTo(Mutate2D.Receiver<Double> receiver) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Access1D
asCollectable1D, asKeyed1D, asList, axpy, dot, select, supplyTo, toList, toRawCopy1DMethods inherited from interface Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, byteValue, byteValue, columns, columns, columns, doubleValue, doubleValue, doubleValue, elements, floatValue, floatValue, floatValue, floatValue, get, intValue, intValue, intValue, intValue, longValue, longValue, longValue, longValue, nonzeros, rows, rows, rows, select, select, shortValue, shortValue, shortValue, shortValue, toRawCopy2DMethods inherited from interface Access2D.Collectable
collectMethods inherited from interface Structure2D
count, firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Field Details
-
myCursor
private int myCursor -
myData
-
-
Constructor Details
-
DataBatch
DataBatch(Mutate2D.ModifiableReceiver<Double> data)
-
-
Method Details
-
from
public static DataBatch from(Factory2D<? extends Mutate2D.ModifiableReceiver<Double>> factory, int batchSize, int dataNodes) With the batch size/capacity specified. The returned instance will throw an exception if too many rows are added to it. -
addRow
-
addRows
-
addRowWithSingleUnit
public void addRowWithSingleUnit(int unitIndex) -
countColumns
public long countColumns()Assumes all rows are of equal length and will only check the first. Returns 0 if there are no rows.- Specified by:
countColumnsin interfaceStructure2D- Returns:
- The number of columns
- See Also:
-
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<Double>- Parameters:
row- A row index.col- A column index.- Returns:
- One matrix element
-
get
-
getColDim
public int getColDim()- Specified by:
getColDimin interfaceStructure2D- Returns:
- The number of columns
-
getRowDim
public int getRowDim()- Specified by:
getRowDimin interfaceStructure2D- Returns:
- The number of rows
-
isFull
public boolean isFull() -
remaining
public int remaining()Remaining capacity / batch entries / number of rows. -
reset
public void reset() -
supplyTo
- Specified by:
supplyToin interfaceAccess2D.Collectable<Double, Mutate2D.Receiver<Double>>
-