net.obsearch.dimension
Class DimensionFloat

java.lang.Object
  extended by net.obsearch.dimension.AbstractDimension
      extended by net.obsearch.dimension.DimensionFloat
All Implemented Interfaces:
Comparable<DimensionFloat>

public class DimensionFloat
extends net.obsearch.dimension.AbstractDimension
implements Comparable<DimensionFloat>

DimensionFloat Stores objects of type float.

Author:
Arnoldo Jose Muller Molina

Constructor Summary
DimensionFloat(int position, float value)
          Creates a new DimensionFloat object.
 
Method Summary
 int compareTo(DimensionFloat other)
          Compares this object with other.
static float euclidean(float[] a, float[] b)
          Calculates the euc distance for two tuples
static float[] getBasicTuple(OBFloat[] pivots, OBFloat object)
          Creates a float array from the given pivots and the given object.
static float[] getPrimitiveTuple(long[] pivots, long objectId, net.obsearch.Index<? extends OBFloat> index)
          Calculates the smap tuple for the given objectId, and the given pivots
static float[] getPrimitiveTuple(OBFloat[] pivots, OBFloat object)
          Calculates the smap tuple for the given objectId, and the given pivots
static DimensionFloat[] getTuple(long[] pivots, long objectId, net.obsearch.Index<? extends OBFloat> index)
          Creates a dimension array from the given pivots and the given object id.
static DimensionFloat[] getTuple(OBFloat[] pivots, OBFloat object)
          Creates a dimension array from the given pivots and the given object.
 float getValue()
           
static float lInfinite(float[] a, float[] b)
          Calculates L-inf for two float tuples.
static float minDistance(List<Long> objects, net.obsearch.Index<OBFloat> index)
          Calculate the minimum distance of the given objects (all objects compared against all objects)
static long[] select(int k, Random r, cern.colt.list.LongArrayList source, net.obsearch.Index<OBFloat> index, cern.colt.list.LongArrayList excludes, float minDistance)
          Selects k random elements from the given source.
static DimensionFloat[] transformPrimitiveTuple(float[] tuple)
          Transform the given primitive tuple into a Dimension tuple.
 
Methods inherited from class net.obsearch.dimension.AbstractDimension
getOrder, mapId, max, select
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimensionFloat

public DimensionFloat(int position,
                      float value)
Creates a new DimensionFloat object.

Parameters:
position - The position of this dimension.
value - The value of this dimension.
Method Detail

getTuple

public static DimensionFloat[] getTuple(OBFloat[] pivots,
                                        OBFloat object)
                                 throws net.obsearch.exception.IllegalIdException,
                                        IllegalAccessException,
                                        InstantiationException,
                                        net.obsearch.exception.OBException
Creates a dimension array from the given pivots and the given object.

Parameters:
pivots - The pivots used for the embedding.
object - The object to be projected.
Returns:
A new dimension array.
Throws:
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException
net.obsearch.exception.OBException

select

public static long[] select(int k,
                            Random r,
                            cern.colt.list.LongArrayList source,
                            net.obsearch.Index<OBFloat> index,
                            cern.colt.list.LongArrayList excludes,
                            float minDistance)
                     throws net.obsearch.exception.IllegalIdException,
                            net.obsearch.exception.OBException,
                            IllegalAccessException,
                            InstantiationException
Selects k random elements from the given source.

Parameters:
k - number of elements to select
r - Random object used to randomly select objects.
source - The source of item ids.
index - underlying index.
will - not add pivots included in excludes.
minDistance - The min distance required by the objects.
Returns:
The ids of selected objects.
Throws:
net.obsearch.exception.IllegalIdException
net.obsearch.exception.OBException
IllegalAccessException
InstantiationException

minDistance

public static float minDistance(List<Long> objects,
                                net.obsearch.Index<OBFloat> index)
                         throws net.obsearch.exception.IllegalIdException,
                                net.obsearch.exception.OBException,
                                IllegalAccessException,
                                InstantiationException
Calculate the minimum distance of the given objects (all objects compared against all objects)

Parameters:
objects -
Returns:
the min distance
Throws:
net.obsearch.exception.IllegalIdException
net.obsearch.exception.OBException
IllegalAccessException
InstantiationException

getBasicTuple

public static float[] getBasicTuple(OBFloat[] pivots,
                                    OBFloat object)
                             throws net.obsearch.exception.IllegalIdException,
                                    IllegalAccessException,
                                    InstantiationException,
                                    net.obsearch.exception.OBException
Creates a float array from the given pivots and the given object.

Parameters:
pivots - The pivots used for the embedding.
object - The object to be projected.
Returns:
A new float array.
Throws:
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException
net.obsearch.exception.OBException

getTuple

public static DimensionFloat[] getTuple(long[] pivots,
                                        long objectId,
                                        net.obsearch.Index<? extends OBFloat> index)
                                 throws net.obsearch.exception.IllegalIdException,
                                        IllegalAccessException,
                                        InstantiationException,
                                        net.obsearch.exception.OBException
Creates a dimension array from the given pivots and the given object id. Loads the objects from the DB.

Throws:
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException
net.obsearch.exception.OBException

compareTo

public int compareTo(DimensionFloat other)
Compares this object with other.

Specified by:
compareTo in interface Comparable<DimensionFloat>

getValue

public float getValue()

getPrimitiveTuple

public static float[] getPrimitiveTuple(long[] pivots,
                                        long objectId,
                                        net.obsearch.Index<? extends OBFloat> index)
                                 throws net.obsearch.exception.IllegalIdException,
                                        IllegalAccessException,
                                        InstantiationException,
                                        net.obsearch.exception.OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException
net.obsearch.exception.OBException

transformPrimitiveTuple

public static DimensionFloat[] transformPrimitiveTuple(float[] tuple)
Transform the given primitive tuple into a Dimension tuple.

Parameters:
tuple - The tuple that will be transformed.
Returns:
A DimensionFloat of dimensions.

getPrimitiveTuple

public static float[] getPrimitiveTuple(OBFloat[] pivots,
                                        OBFloat object)
                                 throws net.obsearch.exception.IllegalIdException,
                                        IllegalAccessException,
                                        InstantiationException,
                                        net.obsearch.exception.OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException
net.obsearch.exception.OBException

lInfinite

public static float lInfinite(float[] a,
                              float[] b)
Calculates L-inf for two float tuples.

Parameters:
a - tuple
b - tuple
Returns:
L-infinite for a and b.

euclidean

public static float euclidean(float[] a,
                              float[] b)
Calculates the euc distance for two tuples

Parameters:
a - tuple
b - tuple
Returns:
L-infinite for a and b.


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