Package elki.projection
Interface AffinityMatrix
-
- All Known Implementing Classes:
DenseAffinityMatrix,SparseAffinityMatrix
public interface AffinityMatrixAbstraction interface for an affinity matrix.- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doubleget(int i, int j)Get an entry by absolute position.intiter(int x)Iterator over non-zero features only.intiterAdvance(int x, int iter)Advance the iterator to the next position.DBIDArrayIteriterDBIDs()Array iterator over the stored objects.intiterDim(int x, int iter)Get the dimension an iterator points to.booleaniterValid(int x, int iter)Test the iterator position for validity.doubleiterValue(int x, int iter)Get the value an iterator points to.voidscale(double d)Scale the whole matrix with a constant factor d.intsize()Number of rows.
-
-
-
Method Detail
-
scale
void scale(double d)
Scale the whole matrix with a constant factor d. This is used to add/remove early exaggeration of tSNE.- Parameters:
d- Scaling factor.
-
size
int size()
Number of rows.- Returns:
- Size
-
get
double get(int i, int j)Get an entry by absolute position. Note: this may be expensive on sparse matrixes.- Parameters:
i- Rowj- Column- Returns:
- Entry
-
iter
int iter(int x)
Iterator over non-zero features only. Note: depending on the underlying implementation, this may or may not be the dimension. UseiterDim(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:
Important: you need to use the return value of iterAdvance for the next iteration, or you will have an endless loop.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); }- Parameters:
x- Point to get the neighbors for- Returns:
- Identifier for the first non-zero dimension, not necessarily the dimension!
-
iterDim
int iterDim(int x, int iter)Get the dimension an iterator points to.- Parameters:
iter- Iterator position- Returns:
- Dimension the iterator refers to
-
iterValue
double iterValue(int x, int iter)Get the value an iterator points to.- Parameters:
iter- Iterator position- Returns:
- Dimension the iterator refers to
-
iterAdvance
int iterAdvance(int x, int iter)Advance the iterator to the next position.- Parameters:
iter- Previous iterator position- Returns:
- Next iterator position
-
iterValid
boolean iterValid(int x, int iter)Test the iterator position for validity.- Parameters:
iter- Iterator position- Returns:
truewhen it refers to a valid position.
-
iterDBIDs
DBIDArrayIter iterDBIDs()
Array iterator over the stored objects.- Returns:
- DBID iterator
-
-