public interface Matrix2D<R,C,V>
for matrix storing objects.
Modifier and Type | Method and Description |
---|---|
void |
addColumnName(C s)
Add a column name, to the end of the current column names.
|
double[][] |
asDoubles()
Attempt to coerce the entries into doubles.
|
void |
assign(V value)
Set all values in the matrix to the given value.
|
int |
columns()
Get the number of columns the matrix has.
|
boolean |
containsColumnName(C columnName) |
boolean |
containsRowName(R rowName) |
V |
getByKeys(R r,
C c) |
int |
getColIndexByName(C s)
Get the index of a column by name.
|
C |
getColName(int i)
Gte the column name for an index.
|
List<C> |
getColNames() |
V |
getEntry(int i,
int j) |
int |
getRowIndexByName(R s)
Get the index of a row by name..
|
R |
getRowName(int i)
Get the row name for an index
|
Iterator<R> |
getRowNameMapIterator() |
List<R> |
getRowNames() |
boolean |
hasColNames()
Check if this matrix has a valid set of column names.
|
boolean |
hasRow(R r) |
boolean |
hasRowNames() |
boolean |
isMissing(int i,
int j)
Check if the value at a given index is missing.
|
int |
numMissing()
Return the number of missing values in the matrix.
|
int |
rows()
Get the number of rows the matrix has
|
void |
set(int row,
int column,
V value) |
void |
setByKeys(R r,
C c,
V v) |
void |
setColumnName(C s,
int index)
Add a column name associated with an index.
|
void |
setColumnNames(List<C> v) |
void |
setRowName(R s,
int index)
Add a row name associated with a row index.
|
void |
setRowNames(List<R> v) |
void addColumnName(C s)
s
- Object a column namedouble[][] asDoubles()
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.
void assign(V value)
value
- int columns()
boolean containsColumnName(C columnName)
columnName
- boolean containsRowName(R rowName)
rowName
- int getColIndexByName(C s)
s
- ObjectC getColName(int i)
i
- intList<C> getColNames()
V getEntry(int i, int j)
i
- j
- int getRowIndexByName(R s)
s
- ObjectR getRowName(int i)
i
- intboolean hasColNames()
boolean hasRow(R r)
r
- Objectboolean hasRowNames()
boolean isMissing(int i, int j)
i
- rowj
- columnint numMissing()
int rows()
void set(int row, int column, V value)
row
- column
- value
- void setColumnName(C s, int index)
s
- Object a column nameindex
- int the column index associated with this namevoid setRowName(R s, int index)
s
- Objectindex
- intCopyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.