java.lang.Object
uk.ac.manchester.tornado.api.types.matrix.Matrix2DInt
- All Implemented Interfaces:
Serializable,PrimitiveStorage<IntBuffer>,TornadoMatrixInterface<IntBuffer>
Matrix2DInt relies on preview features of the Java platform:
Matrix2DIntrefers to one or more preview APIs:MemorySegment.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMatrix2DInt(int[][] matrix) Matrix2DInt(int rows, int columns) Storage format for matrix.Matrix2DInt(int rows, int columns, IntArray array) Storage format for matrix. -
Method Summary
Modifier and TypeMethodDescriptionasBuffer()voidclear()column(int col) diag()voidfill(int value) intget(int i, int j) intgetFinalIndexOfRange(int fromIndex) It returns the final index of the range to be copied, starting from the input parameter.longlongintintvoidloadFromBuffer(IntBuffer buffer) voidmultiply(Matrix2DInt a, Matrix2DInt b) row(int row) static voidscale(Matrix2DInt matrix, int value) voidset(int i, int j, int value) voidset(Matrix2DInt m) intsize()toString()static voidtranspose(Matrix2DInt matrix) Transposes the matrix in-place.
-
Field Details
-
ROWS
protected final int ROWSNumber of rows. -
COLUMNS
protected final int COLUMNSNumber of columns.
-
-
Constructor Details
-
Matrix2DInt
Storage format for matrix.- Parameters:
rows- number of rowscolumns- number of columnsarray- array reference which contains data
-
Matrix2DInt
public Matrix2DInt(int rows, int columns) Storage format for matrix.- Parameters:
rows- number of rowscolumns- number of columns
-
Matrix2DInt
public Matrix2DInt(int[][] matrix)
-
-
Method Details
-
transpose
Transposes the matrix in-place.- Parameters:
matrix- matrix to transpose
-
scale
-
clear
public void clear() -
get
public int get(int i, int j) -
set
public void set(int i, int j, int value) -
row
-
column
-
diag
-
fill
public void fill(int value) -
multiply
-
duplicate
-
set
-
toString
-
toString
-
loadFromBuffer
- Specified by:
loadFromBufferin interfacePrimitiveStorage<IntBuffer>
-
asBuffer
- Specified by:
asBufferin interfacePrimitiveStorage<IntBuffer>
-
size
public int size()- Specified by:
sizein interfacePrimitiveStorage<IntBuffer>
-
getNumBytes
public long getNumBytes()- Specified by:
getNumBytesin interfaceTornadoMatrixInterface<IntBuffer>
-
getNumBytesWithHeader
public long getNumBytesWithHeader()- Specified by:
getNumBytesWithHeaderin interfaceTornadoMatrixInterface<IntBuffer>
-
getSegment
- Specified by:
getSegmentin interfaceTornadoMatrixInterface<IntBuffer>
-
getSegmentWithHeader
- Specified by:
getSegmentWithHeaderin interfaceTornadoMatrixInterface<IntBuffer>
-
getNumRows
public int getNumRows() -
getNumColumns
public int getNumColumns() -
getFinalIndexOfRange
public int getFinalIndexOfRange(int fromIndex) It returns the final index of the range to be copied, starting from the input parameter.- Parameters:
fromIndex-- Returns:
- int
-
Matrix2DIntwhen preview features are enabled.