|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.util.HalfDoubleMatrix
public final class HalfDoubleMatrix
This stores half a matrix of doubles efficiently in just one array. The
access function get(int, int)
works symmetrically. Upon creating the
matrix you can choose if place for the diagonal should be reserved or not.
It is also possible to save the contents of the matrix into a node settings
object and load it again from there afterwards.
Constructor Summary | |
---|---|
HalfDoubleMatrix(ConfigRO config)
Loads a half int matrix from the given node settings object. |
|
HalfDoubleMatrix(int rows,
boolean withDiagonal)
Creates a new half-matrix of doubles. |
Method Summary | |
---|---|
void |
fill(double value)
Fills the matrix with the given value. |
double |
get(int row,
int col)
Returns a value in the matrix. |
int |
getRowCount()
Returns the number of rows the half matrix has. |
void |
permute(int[] permutation)
Permutes the matrix based on the permutation given in the parameter. |
void |
save(ConfigWO config)
Saves the matrix directly into the passed node settings object. |
void |
set(int row,
int col,
double value)
Sets a value in the matrix. |
boolean |
storesDiagonal()
Returns if the half matrix also stores the diagonal or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HalfDoubleMatrix(int rows, boolean withDiagonal)
rows
- the number of rows (and columns) in the matrixwithDiagonal
- true
if the diagonal should be stored
too, false
otherwisepublic HalfDoubleMatrix(ConfigRO config) throws InvalidSettingsException
config
- a node settings object
InvalidSettingsException
- if the passed node settings do not
contain valid settingsMethod Detail |
---|
public void set(int row, int col, double value)
set(i, j, 1)
is the same as set(j, i, 1)
.
row
- the value's rowcol
- the value's columnvalue
- the valuepublic double get(int row, int col)
get(i, j)
is the same as get(j, i)
.
row
- the value's rowcol
- the value's column
public void fill(double value)
value
- any valuepublic void save(ConfigWO config)
config
- a node settings object.public boolean storesDiagonal()
true
if the diagonal is stored, false
otherwisepublic int getRowCount()
public void permute(int[] permutation)
permutation
- an array in which at position i is the index
where the old row i is moved to, i.e.
{ 2, 3, 0, 1 }
means that rows (and columns) 0
and 2 are swapped and rows 1 and 3
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |