public interface AffinityMatrix
Modifier and Type | Method and Description |
---|---|
double |
get(int i,
int j)
Get an entry by absolute position.
|
int |
iter(int x)
Iterator over non-zero features only.
|
int |
iterAdvance(int x,
int iter)
Advance the iterator to the next position.
|
DBIDArrayIter |
iterDBIDs()
Array iterator over the stored objects.
|
int |
iterDim(int x,
int iter)
Get the dimension an iterator points to.
|
boolean |
iterValid(int x,
int iter)
Test the iterator position for validity.
|
double |
iterValue(int x,
int iter)
Get the value an iterator points to.
|
void |
scale(double d)
Scale the whole matrix with a constant factor d.
|
int |
size()
Number of rows.
|
void scale(double d)
d
- Scaling factor.int size()
double get(int i, int j)
i
- Rowj
- Columnint iter(int x)
iterDim(int, int)
to get the actual dimension. In fact,
usually this will be the ith non-zero value, assuming an array
representation.
Think of this number as an iterator. But for efficiency, it has a
primitive type, so it does not require garbage collection. With Java 10
value types, we will likely be able to make this both type-safe
and highly efficient again.
Intended usage:
for (int iter = v.iter(x); v.iterValid(x, iter); iter = v.iterAdvance(x, iter)) {
final int dim = v.iterDim(x, iter);
final int val = v.iterValue(x, iter);
}
Important: you need to use the return value of iterAdvance for the
next iteration, or you will have an endless loop.x
- Point to get the neighbors forint iterDim(int x, int iter)
iter
- Iterator positiondouble iterValue(int x, int iter)
iter
- Iterator positionint iterAdvance(int x, int iter)
iter
- Previous iterator positionboolean iterValid(int x, int iter)
iter
- Iterator positiontrue
when it refers to a valid position.DBIDArrayIter iterDBIDs()
Copyright © 2019 ELKI Development Team. License information.