|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.util.HalfIntMatrix
public final class HalfIntMatrix
This stores half a matrix of ints 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 | |
---|---|
HalfIntMatrix(ConfigRO config)
Loads a half int matrix from the given node settings object. |
|
HalfIntMatrix(int rows,
boolean withDiagonal)
Creates a new half-matrix of ints. |
Method Summary | |
---|---|
void |
fill(int value)
Fills the matrix with the given value. |
int |
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,
int 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 HalfIntMatrix(int rows, boolean withDiagonal)
rows
- the number of rows (and columns) in the matrixwithDiagonal
- true
if the diagonal should be stored
too, false
otherwisepublic HalfIntMatrix(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, int value)
set(i, j, 1)
is the same as set(j, i, 1)
.
row
- the value's rowcol
- the value's columnvalue
- the valuepublic int 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(int 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 |