net.obsearch.index.ghs
Class AbstractSketch64<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>

java.lang.Object
  extended by net.obsearch.index.AbstractOBIndex<O>
      extended by net.obsearch.index.pivot.AbstractPivotOBIndex<O>
          extended by net.obsearch.index.bucket.AbstractBucketIndex<O,B,Q,BC>
              extended by net.obsearch.index.sorter.AbstractBucketSorter<O,B,Q,BC,SketchProjection,CBitVector>
                  extended by net.obsearch.index.ghs.AbstractSketch64<O,B,Q,BC>
All Implemented Interfaces:
Index<O>
Direct Known Subclasses:
Sketch64Byte, Sketch64Double, Sketch64Float, Sketch64Int, Sketch64Long, Sketch64Short

public abstract class AbstractSketch64<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>>
extends AbstractBucketSorter<O,B,Q,BC,SketchProjection,CBitVector>

AbstractSketch64 encapsulates functionality common to a Sketch. The maximum number of bits has been artificially set to 64 bits to optimize performance. If you use less than 64 bits the keys used for the sketch only use the amount of bits the user specifies. Nevertheless the handling of priority queues and the matching itself occurs on longs. It should affect considerably AMD64 architectures. If you are using a 32 bits processor or operating system, then this implementation will not be as efficient.

Author:
Arnoldo Jose Muller Molina

Nested Class Summary
 
Nested classes/interfaces inherited from class net.obsearch.index.bucket.AbstractBucketIndex
AbstractBucketIndex.BucketIterator
 
Field Summary
protected  int[][] distortionStats
          Distortion stats
protected  int m
          Number of bits.
protected  IncrementalPairPivotSelector<O> maskPivotSelector
          Pivot selector for the masks.
protected  O[][] pivotGrid
          pivot grid.
 
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
AbstractSketch64()
           
AbstractSketch64(Class<O> type, IncrementalPairPivotSelector<O> pivotSelector, int m, int bucketPivotCount)
           
 
Method Summary
protected  CBitVector bytesToCompactRepresentation(byte[] data)
           
protected  byte[] compactRepresentationToBytes(CBitVector cp)
           
 void debugDist()
           
 void freeze()
          Freezes the index.
protected  void updateDistance(SketchProjection query, CBitVector proj, FixedPriorityQueue<SketchProjection> queue)
          Calculates the distance between a query and some projection
 
Methods inherited from class net.obsearch.index.sorter.AbstractBucketSorter
bucketStats, calculateEstimators, close, estimateK, freezeDefault, getAddress, getAllObjects, getBucketContainer, getBucketPivotCount, getCPSize, getExpectedEP, getKQuery, getMaxK, getPInstance, getProjection, init, initByteArrayBuckets, initCache, insertBucket, insertBucketBulk, loadMasks, maxKEstimation, maxKEstimationAux, printEstimation, searchBuckets, setExpectedError, setKAlpha, setMaxK, setSampleSize
 
Methods inherited from class net.obsearch.index.bucket.AbstractBucketIndex
debug, deleteAux, exists, getBucket, getBuckets, getObjectFreeze, idMap, insertAux, insertAuxBulk, instantiateBucketContainer, iterateBuckets, primitiveDataTypeSize
 
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, distance, 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
 

Field Detail

m

protected int m
Number of bits.


pivotGrid

protected O extends OB[][] pivotGrid
pivot grid.


distortionStats

protected int[][] distortionStats
Distortion stats


maskPivotSelector

protected IncrementalPairPivotSelector<O extends OB> maskPivotSelector
Pivot selector for the masks.

Constructor Detail

AbstractSketch64

public AbstractSketch64()

AbstractSketch64

public AbstractSketch64(Class<O> type,
                        IncrementalPairPivotSelector<O> pivotSelector,
                        int m,
                        int bucketPivotCount)
                 throws OBStorageException,
                        OBException
Throws:
OBStorageException
OBException
Method Detail

compactRepresentationToBytes

protected byte[] compactRepresentationToBytes(CBitVector cp)
Specified by:
compactRepresentationToBytes in class AbstractBucketSorter<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>,SketchProjection,CBitVector>

bytesToCompactRepresentation

protected CBitVector bytesToCompactRepresentation(byte[] data)
Specified by:
bytesToCompactRepresentation in class AbstractBucketSorter<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>,SketchProjection,CBitVector>

freeze

public void freeze()
            throws AlreadyFrozenException,
                   IllegalIdException,
                   OutOfRangeException,
                   IllegalAccessException,
                   InstantiationException,
                   OBException,
                   PivotsUnavailableException,
                   IOException
Description copied from interface: Index
Freezes the index. From this point data can be inserted, searched and deleted. The index might deteriorate at some point so every once in a while it is a good idea to rebuild the index. A PivotSelector must be executed before calling this method.

Specified by:
freeze in interface Index<O extends OB>
Overrides:
freeze in class AbstractPivotOBIndex<O extends OB>
Throws:
AlreadyFrozenException - If the index was already frozen and the user attempted to freeze it again
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
OutOfRangeException - If the distance of any object to any other object exceeds the range defined by the user.
IllegalAccessException - If there is a problem when instantiating objects O
InstantiationException - If there is a problem when instantiating objects O
OBStorageException - If something goes wrong with the DB
OBException - User generated exception
PivotsUnavailableException
IOException - if the index serialization process fails
See Also:
Index.freeze()

debugDist

public void debugDist()
               throws IllegalIdException,
                      OBStorageException,
                      IllegalAccessException,
                      InstantiationException,
                      OBException,
                      IOException
Throws:
IllegalIdException
OBStorageException
IllegalAccessException
InstantiationException
OBException
IOException

updateDistance

protected void updateDistance(SketchProjection query,
                              CBitVector proj,
                              FixedPriorityQueue<SketchProjection> queue)
Description copied from class: AbstractBucketSorter
Calculates the distance between a query and some projection

Specified by:
updateDistance in class AbstractBucketSorter<O extends OB,B extends BucketObject<O>,Q,BC extends BucketContainer<O,B,Q>,SketchProjection,CBitVector>


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.