Package org.ojalgo.structure
Class AccessAnyD.MatrixView<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.structure.AccessAnyD.MatrixView<N>
-
- All Implemented Interfaces:
java.lang.Comparable<AccessAnyD.MatrixView<N>>
,java.lang.Iterable<AccessAnyD.MatrixView<N>>
,java.util.Iterator<AccessAnyD.MatrixView<N>>
,Access1D<N>
,Access2D<N>
,Access2D.Collectable<N,Mutate2D>
,Structure1D
,Structure2D
- Enclosing interface:
- AccessAnyD<N extends java.lang.Comparable<N>>
public static final class AccessAnyD.MatrixView<N extends java.lang.Comparable<N>> extends java.lang.Object implements Access2D<N>, java.lang.Iterable<AccessAnyD.MatrixView<N>>, java.util.Iterator<AccessAnyD.MatrixView<N>>, java.lang.Comparable<AccessAnyD.MatrixView<N>>, Access2D.Collectable<N,Mutate2D>
-
-
Nested Class Summary
-
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.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 long
myColumnsCount
private long
myCount
private AccessAnyD<N>
myDelegateAnyD
private long
myLastOffset
private long
myOffset
private long
myRowsCount
-
Constructor Summary
Constructors Modifier Constructor Description protected
MatrixView(AccessAnyD<N> access)
(package private)
MatrixView(AccessAnyD<N> access, long index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AccessAnyD.MatrixView<N> other)
long
count()
count() == countRows() * countColumns()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.double
doubleValue(long row, long col)
long
estimateSize()
N
get(long row, long col)
int
getColDim()
(package private) long
getOffset()
int
getRowDim()
void
goToMatrix(long index)
Move the view to a specific matrix.boolean
hasNext()
boolean
hasPrevious()
long
index()
If the underlyingAccessAnyD
data structure was created as 4x5x7x8, it can be viewed as 7x8 4x5 matrices.AccessAnyD.MatrixView<N>
iterator()
AccessAnyD.MatrixView<N>
next()
AccessAnyD.MatrixView<N>
previous()
void
remove()
void
supplyTo(Mutate2D 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.Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, byteValue, byteValue, columns, columns, columns, 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, toRawCopy2D
-
Methods inherited from interface org.ojalgo.structure.Access2D.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Structure2D
firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
myColumnsCount
private final long myColumnsCount
-
myCount
private final long myCount
-
myDelegateAnyD
private final AccessAnyD<N extends java.lang.Comparable<N>> myDelegateAnyD
-
myLastOffset
private final long myLastOffset
-
myOffset
private long myOffset
-
myRowsCount
private final long myRowsCount
-
-
Constructor Detail
-
MatrixView
protected MatrixView(AccessAnyD<N> access)
-
MatrixView
MatrixView(AccessAnyD<N> access, long index)
-
-
Method Detail
-
compareTo
public int compareTo(AccessAnyD.MatrixView<N> other)
-
count
public long count()
Description copied from interface:Structure2D
count() == countRows() * countColumns()- Specified by:
count
in interfaceStructure1D
- Specified by:
count
in interfaceStructure2D
-
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>>
- Parameters:
row
- A row index.col
- A column index.- Returns:
- One matrix element
-
doubleValue
public double doubleValue(long row, long col)
- Specified by:
doubleValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
estimateSize
public long estimateSize()
-
get
public N get(long row, long col)
-
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
-
goToMatrix
public void goToMatrix(long index)
Move the view to a specific matrix. The index specified here should correspond to what is returned by theindex()
method.- See Also:
index()
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
-
index
public long index()
If the underlyingAccessAnyD
data structure was created as 4x5x7x8, it can be viewed as 7x8 4x5 matrices. The dimensions of the MatrixView would be 4x5, and the index returned by this method indicates which of 7x8 matrices the view currently points to. The range of these indices would be 0-55.- Returns:
- The index of the matrix (which matrix are we currently viewing).
-
iterator
public AccessAnyD.MatrixView<N> iterator()
-
next
public AccessAnyD.MatrixView<N> next()
-
previous
public AccessAnyD.MatrixView<N> previous()
-
remove
public void remove()
-
supplyTo
public void supplyTo(Mutate2D receiver)
- Specified by:
supplyTo
in interfaceAccess2D.Collectable<N extends java.lang.Comparable<N>,Mutate2D>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOffset
long getOffset()
-
-