net.obsearch.index.ghs.impl
Class Sketch64Long<O extends OBLong>
java.lang.Object
net.obsearch.index.AbstractOBIndex<O>
net.obsearch.index.pivot.AbstractPivotOBIndex<O>
net.obsearch.index.bucket.AbstractBucketIndex<O,B,Q,BC>
net.obsearch.index.sorter.AbstractBucketSorter<O,B,Q,BC,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
net.obsearch.index.ghs.AbstractSketch64<O,BucketObjectLong<O>,OBQueryLong<O>,SleekBucketLong<O>>
net.obsearch.index.ghs.impl.Sketch64Long<O>
- All Implemented Interfaces:
- net.obsearch.Index<O>, IndexLong<O>
public final class Sketch64Long<O extends OBLong>
- extends net.obsearch.index.ghs.AbstractSketch64<O,BucketObjectLong<O>,OBQueryLong<O>,SleekBucketLong<O>>
- implements IndexLong<O>
Nested classes/interfaces inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
net.obsearch.index.bucket.AbstractBucketIndex.BucketIterator |
Fields inherited from class net.obsearch.index.ghs.AbstractSketch64 |
distortionStats, m, maskPivotSelector, pivotGrid |
Fields inherited from class net.obsearch.index.sorter.AbstractBucketSorter |
bucketCache, bucketPivotCount, kEstimators, projections, projectionStorage, userK |
Fields inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
Buckets |
Fields inherited from class net.obsearch.index.pivot.AbstractPivotOBIndex |
intrinsicDimensionalityPairs, pivots, pivotSelector |
Fields inherited from class net.obsearch.index.AbstractOBIndex |
A, fact, isFrozen, stats, type |
Fields inherited from interface net.obsearch.Index |
ID_SIZE |
Constructor Summary |
Sketch64Long()
|
Sketch64Long(Class<O> type,
net.obsearch.pivots.IncrementalPairPivotSelector<O> pivotSelector,
int m)
Create a new Sketch64Long with m bytes. |
Method Summary |
protected double |
distance(O a,
O b)
|
long[] |
fullMatchLite(O query,
boolean filterSame)
This method returns a list of all the distances of the query against the DB. |
BucketObjectLong<O> |
getBucket(O object)
|
protected int |
getCPSize()
|
protected net.obsearch.query.AbstractOBQuery<O> |
getKQuery(O object,
int k)
|
protected Class<net.obsearch.index.ghs.CBitVector> |
getPInstance()
|
net.obsearch.index.ghs.SketchProjection |
getProjection(BucketObjectLong<O> bucket)
Compute the sketch for the given object. |
protected SleekBucketLong<O> |
instantiateBucketContainer(byte[] data,
byte[] address)
|
Iterator<List<OBQueryLong<O>>> |
knnGraph(int k,
long r)
Performs a knn graph search |
protected void |
maxKEstimationAux(O object)
Get the kMax closest objects. |
protected int |
primitiveDataTypeSize()
|
void |
searchOB(O object,
long r,
net.obsearch.filter.Filter<O> filter,
OBPriorityQueueLong<O> result)
Searches the Index and returns OBResult (ID, OB and distance)
elements that are closer to "object". |
void |
searchOB(O object,
long r,
OBPriorityQueueLong<O> result)
Searches the Index and returns OBResult (ID, OB and distance)
elements that are closer to "object". |
Methods inherited from class net.obsearch.index.ghs.AbstractSketch64 |
bytesToCompactRepresentation, compactRepresentationToBytes, debugDist, freeze, updateDistance |
Methods inherited from class net.obsearch.index.sorter.AbstractBucketSorter |
bucketStats, calculateEstimators, close, estimateK, freezeDefault, getAddress, getAllObjects, getBucketContainer, getBucketPivotCount, getExpectedEP, getMaxK, init, initByteArrayBuckets, initCache, insertBucket, insertBucketBulk, loadMasks, maxKEstimation, printEstimation, searchBuckets, setExpectedError, setKAlpha, setMaxK, setSampleSize |
Methods inherited from class net.obsearch.index.bucket.AbstractBucketIndex |
debug, deleteAux, exists, getBuckets, getObjectFreeze, idMap, insertAux, insertAuxBulk, iterateBuckets |
Methods inherited from class net.obsearch.index.pivot.AbstractPivotOBIndex |
calculateIntrinsicDimensionality, createPivotsArray, getObjects, getPivotCount, selectPivots |
Methods inherited from class net.obsearch.index.AbstractOBIndex |
assertFrozen, bytesToObject, bytesToObject, clearACache, databaseSize, delete, emptyPivotsArray, findAux, getBox, getObject, getStats, getType, initStorageDevices, insert, insert, insertBulk, insertBulk, intrinsicDimensionality, isFrozen, isPreFreeze, isPreFreezeCheck, loadObject, loadPivots, objectToByteBuffer, objectToBytes, resetStats, serializePivots, setFixedRecord, setFixedRecord, setIdAutoGeneration, setPreFreeze, setPreFreezeCheck, totalBoxes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.obsearch.Index |
close, databaseSize, debug, delete, exists, freeze, getBox, getObject, getStats, getType, init, insert, insert, insertBulk, insertBulk, isFrozen, loadObject, resetStats, setPreFreezeCheck, totalBoxes |
Sketch64Long
public Sketch64Long(Class<O> type,
net.obsearch.pivots.IncrementalPairPivotSelector<O> pivotSelector,
int m)
throws net.obsearch.exception.OBStorageException,
net.obsearch.exception.OBException,
IOException
- Create a new Sketch64Long with m bytes.
- Parameters:
type
- Type of object that will be storedpivotSelector
- Pivot selection strategy to be employed.m
- The number of bitsbucketPivotCount
- Number of pivots per bucket
- Throws:
net.obsearch.exception.OBStorageException
net.obsearch.exception.OBException
IOException
Sketch64Long
public Sketch64Long()
getBucket
public BucketObjectLong<O> getBucket(O object)
throws net.obsearch.exception.OBException,
InstantiationException,
IllegalAccessException
- Specified by:
getBucket
in class net.obsearch.index.bucket.AbstractBucketIndex<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>>
- Throws:
net.obsearch.exception.OBException
InstantiationException
IllegalAccessException
getProjection
public net.obsearch.index.ghs.SketchProjection getProjection(BucketObjectLong<O> bucket)
throws net.obsearch.exception.OBException
- Compute the sketch for the given object.
- Specified by:
getProjection
in class net.obsearch.index.sorter.AbstractBucketSorter<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
- Throws:
net.obsearch.exception.OBException
instantiateBucketContainer
protected SleekBucketLong<O> instantiateBucketContainer(byte[] data,
byte[] address)
throws InstantiationException,
IllegalAccessException,
net.obsearch.exception.OBException
- Specified by:
instantiateBucketContainer
in class net.obsearch.index.bucket.AbstractBucketIndex<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>>
- Throws:
InstantiationException
IllegalAccessException
net.obsearch.exception.OBException
primitiveDataTypeSize
protected int primitiveDataTypeSize()
- Specified by:
primitiveDataTypeSize
in class net.obsearch.index.bucket.AbstractBucketIndex<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>>
searchOB
public void searchOB(O object,
long r,
OBPriorityQueueLong<O> result)
throws net.obsearch.exception.NotFrozenException,
InstantiationException,
net.obsearch.exception.IllegalIdException,
IllegalAccessException,
net.obsearch.exception.OutOfRangeException,
net.obsearch.exception.OBException
- Description copied from interface:
IndexLong
- Searches the Index and returns OBResult (ID, OB and distance)
elements that are closer to "object". The closest element is at the
beginning of the list and the farthest elements is at the end of the
list. You can control the size of the resulting set when you create
the object "result". This becomes the k parameter of the search.
- Specified by:
searchOB
in interface IndexLong<O extends OBLong>
- Parameters:
object
- The object that has to be searchedr
- The range to be usedresult
- A priority queue that will hold the result
- Throws:
net.obsearch.exception.NotFrozenException
- if the index has not been frozen.
InstantiationException
- If there is a problem when instantiating objects O
net.obsearch.exception.IllegalIdException
- This exception is left as a Debug flag. If you receive
this exception please report the problem to:
http://code.google.com/p/obsearch/issues/list
IllegalAccessException
- If there is a problem when instantiating objects O
net.obsearch.exception.OutOfRangeException
- If the distance of any object to any other object exceeds
the range defined by the user.
net.obsearch.exception.OBException
- User generated exception
getKQuery
protected net.obsearch.query.AbstractOBQuery<O> getKQuery(O object,
int k)
throws net.obsearch.exception.OBException,
InstantiationException,
IllegalAccessException
- Specified by:
getKQuery
in class net.obsearch.index.sorter.AbstractBucketSorter<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
- Throws:
net.obsearch.exception.OBException
InstantiationException
IllegalAccessException
searchOB
public void searchOB(O object,
long r,
net.obsearch.filter.Filter<O> filter,
OBPriorityQueueLong<O> result)
throws net.obsearch.exception.NotFrozenException,
InstantiationException,
net.obsearch.exception.IllegalIdException,
IllegalAccessException,
net.obsearch.exception.OutOfRangeException,
net.obsearch.exception.OBException
- Description copied from interface:
IndexLong
- Searches the Index and returns OBResult (ID, OB and distance)
elements that are closer to "object". The closest element is at the
beginning of the list and the farthest elements is at the end of the
list. You can control the size of the resulting set when you create
the object "result". This becomes the k parameter of the search.
The parameter "filter" is used to remove unwanted objects from
the result (a select where clause). Users are responsible to
implement at least one filter that can be used with their O.
- Specified by:
searchOB
in interface IndexLong<O extends OBLong>
- Parameters:
object
- The object that has to be searchedr
- The range to be usedresult
- A priority queue that will hold the result
- Throws:
net.obsearch.exception.NotFrozenException
- if the index has not been frozen.
InstantiationException
- If there is a problem when instantiating objects O
net.obsearch.exception.IllegalIdException
- This exception is left as a Debug flag. If you receive
this exception please report the problem to:
http://code.google.com/p/obsearch/issues/list
IllegalAccessException
- If there is a problem when instantiating objects O
net.obsearch.exception.OutOfRangeException
- If the distance of any object to any other object exceeds
the range defined by the user.
net.obsearch.exception.OBException
- User generated exception
knnGraph
public Iterator<List<OBQueryLong<O>>> knnGraph(int k,
long r)
- Performs a knn graph search
fullMatchLite
public long[] fullMatchLite(O query,
boolean filterSame)
throws net.obsearch.exception.OBException,
IllegalAccessException,
InstantiationException
- This method returns a list of all the distances of the query against the DB.
This helps to calculate EP values in a cheaper way. results that are equal to the original object are added
as Long.MAX_VALUE
- Specified by:
fullMatchLite
in interface IndexLong<O extends OBLong>
- Parameters:
query
- filterSame
- if True we do not return objects o such that query.equals(o)
- Returns:
-
- Throws:
net.obsearch.exception.OBException
InstantiationException
IllegalAccessException
maxKEstimationAux
protected void maxKEstimationAux(O object)
throws net.obsearch.exception.OBException,
InstantiationException,
IllegalAccessException
- Get the kMax closest objects. Count how many different bucket ids are
there for each k and fill in accordingly the tables.
- Specified by:
maxKEstimationAux
in class net.obsearch.index.sorter.AbstractBucketSorter<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
- Parameters:
object
-
- Throws:
net.obsearch.exception.OBException
InstantiationException
IllegalAccessException
distance
protected double distance(O a,
O b)
throws net.obsearch.exception.OBException
- Overrides:
distance
in class net.obsearch.index.AbstractOBIndex<O extends OBLong>
- Throws:
net.obsearch.exception.OBException
getCPSize
protected int getCPSize()
- Specified by:
getCPSize
in class net.obsearch.index.sorter.AbstractBucketSorter<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
getPInstance
protected Class<net.obsearch.index.ghs.CBitVector> getPInstance()
- Specified by:
getPInstance
in class net.obsearch.index.sorter.AbstractBucketSorter<O extends OBLong,BucketObjectLong<O extends OBLong>,OBQueryLong<O extends OBLong>,SleekBucketLong<O extends OBLong>,net.obsearch.index.ghs.SketchProjection,net.obsearch.index.ghs.CBitVector>
Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.