Interface Matrix2D<R,C,V>
- All Known Subinterfaces:
ObjectMatrix<R,C, V>, PrimitiveMatrix<R, C, V>
- All Known Implementing Classes:
AbstractMatrix, CompressedSparseDoubleMatrix, DenseDoubleMatrix, DoubleMatrix, FastRowAccessDoubleMatrix, IntegerMatrix, ObjectMatrixImpl, SparseDoubleMatrix, StringMatrix
public interface Matrix2D<R,C,V>
Represents a matrix with index columns and rows. The keys are generic.
- Author:
- Paul Pavlidis
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnName(C s) Add a column name, to the end of the current column names.double[][]Attempt to coerce the entries into doubles.voidSet all values in the matrix to the given value.intcolumns()Get the number of columns the matrix has.booleancontainsColumnName(C columnName) booleancontainsRowName(R rowName) intGet the index of a column by name.getColName(int i) Gte the column name for an index.getEntry(int i, int j) intGet the index of a row by name..getRowName(int i) Get the row name for an indexbooleanCheck if this matrix has a valid set of column names.booleanbooleanbooleanisMissing(int i, int j) Check if the value at a given index is missing.intReturn the number of missing values in the matrix.introws()Get the number of rows the matrix hasvoidvoidvoidsetColumnName(C s, int index) Add a column name associated with an index.voidsetColumnNames(List<C> v) voidsetRowName(R s, int index) Add a row name associated with a row index.voidsetRowNames(List<R> v)
-
Method Details
-
addColumnName
Add a column name, to the end of the current column names. Useful when building up a matrix in stages.- Parameters:
s- Object a column name
-
asDoubles
double[][] asDoubles()Attempt to coerce the entries into doubles.Numeric entries (Double, BigDecimal, Integer, BigInteger) and Strings that can be parsed as doubles are converted. Booleans are converted to 1 or 0. Dates are converted via Date.getDate(). Null entries are rendered as Double.NaN. For entries that are other types of objects, the HashCode is used.
- Returns:
-
assign
-
columns
int columns()Get the number of columns the matrix has.- Returns:
- int
-
containsColumnName
- Parameters:
columnName-- Returns:
-
containsRowName
- Parameters:
rowName-- Returns:
-
getByKeys
-
getColIndexByName
-
getColName
-
getColNames
-
getEntry
- Parameters:
i-j-- Returns:
-
getRowIndexByName
-
getRowName
-
getRowNameMapIterator
-
getRowNames
-
hasColNames
boolean hasColNames()Check if this matrix has a valid set of column names.- Returns:
- boolean
-
hasRow
- Parameters:
r- Object- Returns:
- boolean
-
hasRowNames
boolean hasRowNames()- Returns:
- boolean
-
isMissing
boolean isMissing(int i, int j) Check if the value at a given index is missing.- Parameters:
i- rowj- column- Returns:
- true if the value is missing, false otherwise.
-
numMissing
int numMissing()Return the number of missing values in the matrix.- Returns:
-
rows
int rows()Get the number of rows the matrix has- Returns:
- int
-
set
- Parameters:
row-column-value-
-
setByKeys
-
setColumnName
Add a column name associated with an index.- Parameters:
s- Object a column nameindex- int the column index associated with this name
-
setColumnNames
-
setRowName
Add a row name associated with a row index.- Parameters:
s- Objectindex- int
-
setRowNames
-