jklustor-overlap-0.0.2-20140619012940 (ChemAxon)


com.chemaxon.overlap
Class KnnResultsImpl

Object
  extended by com.chemaxon.overlap.KnnResultsImpl
All Implemented Interfaces:
KnnResults, Serializable

@Beta
public final class KnnResultsImpl
extends Object
implements KnnResults

Arrays of primitives backed implementation of KnnResults.

Note that query and target IDs might refer to the same or different sets. If they refer to the same set the nearest neighbor list does not contain self ID.

Author:
Gabor Imre
See Also:
Serialized Form

Constructor Summary
KnnResultsImpl(int k, int[] queries, int[] targets, double[] dissimilarities)
          Construct.
 
Method Summary
 void copyTo(int k, int startIndex, int[] q, int[] t, double[] d)
          Low level array copy to target arrays.
 double[] getDissimilarities(int index)
          Dissimilarity.
 int getK()
          Value of k.
 int[] getNeighbors(int index)
          ID of the nearest neighbors of query.
 int getQuery(int index)
          Query ID.
 int getQueryCount()
          Number of queries stored.
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KnnResultsImpl

public KnnResultsImpl(int k,
                      int[] queries,
                      int[] targets,
                      double[] dissimilarities)
Construct.

Parameters:
k - Number of nearest neighbors recorded for each query
queries - Query IDs
targets - Concatenated lists of nearest neighbors
dissimilarities - Dissimilarities
Throws:
IllegalArgumentException - when array sizes mismatch or dissimilarities array contains NaN or INF value
Method Detail

getQuery

public int getQuery(int index)
Description copied from interface: KnnResults
Query ID.

Specified by:
getQuery in interface KnnResults
Parameters:
index - Index
Returns:
Query ID for the given index

toString

public String toString()
Overrides:
toString in class Object

getK

public int getK()
Description copied from interface: KnnResults
Value of k.

Specified by:
getK in interface KnnResults
Returns:
Number of stored neighbors for each query

getQueryCount

public int getQueryCount()
Description copied from interface: KnnResults
Number of queries stored.

Specified by:
getQueryCount in interface KnnResults
Returns:
Number of queries stored

getNeighbors

public int[] getNeighbors(int index)
Description copied from interface: KnnResults
ID of the nearest neighbors of query.

Specified by:
getNeighbors in interface KnnResults
Parameters:
index - Index
Returns:
Nearest neighbor IDs for the given query

getDissimilarities

public double[] getDissimilarities(int index)
Description copied from interface: KnnResults
Dissimilarity.

Specified by:
getDissimilarities in interface KnnResults
Parameters:
index - Index
Returns:
Dissimilarities of the nearest neighbors

copyTo

public void copyTo(int k,
                   int startIndex,
                   int[] q,
                   int[] t,
                   double[] d)
Low level array copy to target arrays.

Parameters:
k - Target k
startIndex - First query index to write
q - qurey index array
t - concatenated knn lists
d - dissimilarities
Throws:
IllegalArgumentException - when trivial consistency checks fail

jklustor-overlap-0.0.2-20140619012940 (ChemAxon)