Class AccessAnyD.MatrixView<N extends Comparable<N>>
java.lang.Object
org.ojalgo.structure.AccessAnyD.MatrixView<N>
- All Implemented Interfaces:
Comparable<AccessAnyD.MatrixView<N>>, Iterable<AccessAnyD.MatrixView<N>>, Iterator<AccessAnyD.MatrixView<N>>, Access1D<N>, Access2D<N>, Access2D.Collectable<N,Mutate2D>, Structure1D, Structure2D
- Enclosing interface:
AccessAnyD<N extends Comparable<N>>
public static final class AccessAnyD.MatrixView<N extends Comparable<N>>
extends Object
implements Access2D<N>, Iterable<AccessAnyD.MatrixView<N>>, Iterator<AccessAnyD.MatrixView<N>>, Comparable<AccessAnyD.MatrixView<N>>, Access2D.Collectable<N,Mutate2D>
-
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
FieldsModifier and TypeFieldDescriptionprivate final longprivate final longprivate final AccessAnyD<N> private final longprivate longprivate final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMatrixView(AccessAnyD<N> access) (package private)MatrixView(AccessAnyD<N> access, long index) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(AccessAnyD.MatrixView<N> other) longcount()count() == countRows() * countColumns()longOnly need to implement if the structure may contain more than Integer.MAX_VALUE elements.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.doubledoubleValue(long row, long col) longget(long row, long col) int(package private) longintvoidgoToMatrix(long index) Move the view to a specific matrix.booleanhasNext()booleanlongindex()If the underlyingAccessAnyDdata structure was created as 4x5x7x8, it can be viewed as 7x8 4x5 matrices.iterator()next()previous()voidremove()voidtoString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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, 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 Iterable
forEach, spliteratorMethods inherited from interface Iterator
forEachRemainingMethods inherited from interface Structure2D
firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Field Details
-
myColumnsCount
private final long myColumnsCount -
myCount
private final long myCount -
myDelegateAnyD
-
myLastOffset
private final long myLastOffset -
myOffset
private long myOffset -
myRowsCount
private final long myRowsCount
-
-
Constructor Details
-
MatrixView
-
MatrixView
MatrixView(AccessAnyD<N> access, long index)
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<N extends Comparable<N>>
-
count
public long count()Description copied from interface:Structure2Dcount() == countRows() * countColumns()- Specified by:
countin interfaceStructure1D- Specified by:
countin interfaceStructure2D
-
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
-
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 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:
doubleValuein interfaceAccess2D<N extends Comparable<N>>
-
estimateSize
public long estimateSize() -
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
-
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:
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<N extends Comparable<N>>
-
hasPrevious
public boolean hasPrevious() -
index
public long index()If the underlyingAccessAnyDdata 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
- Specified by:
iteratorin interfaceIterable<N extends Comparable<N>>
-
next
- Specified by:
nextin interfaceIterator<N extends Comparable<N>>
-
previous
-
remove
public void remove()- Specified by:
removein interfaceIterator<N extends Comparable<N>>
-
supplyTo
- Specified by:
supplyToin interfaceAccess2D.Collectable<N extends Comparable<N>, Mutate2D>
-
toString
-
getOffset
long getOffset()
-