Package org.ejml.data
Class ZMatrixD1
java.lang.Object
org.ejml.data.ZMatrixD1
- All Implemented Interfaces:
Serializable
,Matrix
,ReshapeMatrix
,ZMatrix
- Direct Known Subclasses:
ZMatrixRMaj
A generic abstract class for matrices whose data is stored in a single 1D array of doubles. The
format of the elements in this array is not specified. For example row major, column major,
and block row major are all common formats.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
assignShape
(int rows, int cols) Sets the matrix's shape while checking that it's validdouble[]
getData()
Used to get a reference to the internal data.abstract int
getIndex
(int row, int col) Returns the internal array index for the specified row and column.int
Returns the number of columns in this matrix.int
int
Returns the number of rows in this matrix.void
setData
(double[] data) Changes the internal array reference.void
setNumCols
(int numCols) Sets the number of columns.void
setNumRows
(int numRows) Sets the number of rows.void
Sets the value of this matrix to be the same as the value of the provided matrix.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ejml.data.Matrix
copy, create, createLike, getType, print, print, setTo, zero
Methods inherited from interface org.ejml.data.ReshapeMatrix
reshape
-
Field Details
-
data
public double[] dataWhere the raw data for the matrix is stored. The format is type dependent. -
numRows
public int numRowsNumber of rows in the matrix. -
numCols
public int numColsNumber of columns in the matrix.
-
-
Constructor Details
-
ZMatrixD1
public ZMatrixD1()
-
-
Method Details
-
assignShape
protected void assignShape(int rows, int cols) Sets the matrix's shape while checking that it's valid -
getData
public double[] getData()Used to get a reference to the internal data.- Returns:
- Reference to the matrix's data.
-
setData
public void setData(double[] data) Changes the internal array reference. -
getIndex
public abstract int getIndex(int row, int col) Returns the internal array index for the specified row and column.- Parameters:
row
- Row index.col
- Column index.- Returns:
- Internal array index.
-
setTo
Sets the value of this matrix to be the same as the value of the provided matrix. Both matrices must have the same shape:
aij = bij
- Parameters:
b
- The matrix that this matrix is to be set equal to.
-
getNumRows
public int getNumRows()Returns the number of rows in this matrix.- Specified by:
getNumRows
in interfaceMatrix
- Returns:
- Number of rows.
-
getNumCols
public int getNumCols()Returns the number of columns in this matrix.- Specified by:
getNumCols
in interfaceMatrix
- Returns:
- Number of columns.
-
setNumRows
public void setNumRows(int numRows) Sets the number of rows.- Parameters:
numRows
- Number of rows
-
setNumCols
public void setNumCols(int numCols) Sets the number of columns.- Parameters:
numCols
- Number of columns
-
getNumElements
public int getNumElements()
-