net.obsearch.dimension
Class DimensionDouble

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

public class DimensionDouble
extends AbstractDimension
implements Comparable<DimensionDouble>

DimensionDouble Stores objects of type double.

Author:
Arnoldo Jose Muller Molina

Constructor Summary
DimensionDouble(int position, double value)
          Creates a new DimensionDouble object.
 
Method Summary
 int compareTo(DimensionDouble other)
          Compares this object with other.
static double euclidean(double[] a, double[] b)
          Calculates the euc distance for two tuples
static double[] getBasicTuple(OBDouble[] pivots, OBDouble object)
          Creates a double array from the given pivots and the given object.
static double[] getPrimitiveTuple(long[] pivots, long objectId, Index<? extends OBDouble> index)
          Calculates the smap tuple for the given objectId, and the given pivots
static double[] getPrimitiveTuple(OBDouble[] pivots, OBDouble object)
          Calculates the smap tuple for the given objectId, and the given pivots
static DimensionDouble[] getTuple(long[] pivots, long objectId, Index<? extends OBDouble> index)
          Creates a dimension array from the given pivots and the given object id.
static DimensionDouble[] getTuple(OBDouble[] pivots, OBDouble object)
          Creates a dimension array from the given pivots and the given object.
 double getValue()
           
static double lInfinite(double[] a, double[] b)
          Calculates L-inf for two double tuples.
static double minDistance(List<Long> objects, Index<OBDouble> 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, Index<OBDouble> index, cern.colt.list.LongArrayList excludes, double minDistance)
          Selects k random elements from the given source.
static DimensionDouble[] transformPrimitiveTuple(double[] 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

DimensionDouble

public DimensionDouble(int position,
                       double value)
Creates a new DimensionDouble object.

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

getTuple

public static DimensionDouble[] getTuple(OBDouble[] pivots,
                                         OBDouble object)
                                  throws IllegalIdException,
                                         IllegalAccessException,
                                         InstantiationException,
                                         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:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

select

public static long[] select(int k,
                            Random r,
                            cern.colt.list.LongArrayList source,
                            Index<OBDouble> index,
                            cern.colt.list.LongArrayList excludes,
                            double minDistance)
                     throws IllegalIdException,
                            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:
IllegalIdException
OBException
IllegalAccessException
InstantiationException

minDistance

public static double minDistance(List<Long> objects,
                                 Index<OBDouble> index)
                          throws IllegalIdException,
                                 OBException,
                                 IllegalAccessException,
                                 InstantiationException
Calculate the minimum distance of the given objects (all objects compared against all objects)

Parameters:
objects -
Returns:
the min distance
Throws:
IllegalIdException
OBException
IllegalAccessException
InstantiationException

getBasicTuple

public static double[] getBasicTuple(OBDouble[] pivots,
                                     OBDouble object)
                              throws IllegalIdException,
                                     IllegalAccessException,
                                     InstantiationException,
                                     OBException
Creates a double 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 double array.
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

getTuple

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

Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

compareTo

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

Specified by:
compareTo in interface Comparable<DimensionDouble>

getValue

public double getValue()

getPrimitiveTuple

public static double[] getPrimitiveTuple(long[] pivots,
                                         long objectId,
                                         Index<? extends OBDouble> index)
                                  throws IllegalIdException,
                                         IllegalAccessException,
                                         InstantiationException,
                                         OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

transformPrimitiveTuple

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

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

getPrimitiveTuple

public static double[] getPrimitiveTuple(OBDouble[] pivots,
                                         OBDouble object)
                                  throws IllegalIdException,
                                         IllegalAccessException,
                                         InstantiationException,
                                         OBException
Calculates the smap tuple for the given objectId, and the given pivots

Parameters:
pivots -
objectId -
Returns:
Throws:
IllegalIdException
IllegalAccessException
InstantiationException
OBException

lInfinite

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

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

euclidean

public static double euclidean(double[] a,
                               double[] 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.