anl.aida.util
Class VectorUtilities

java.lang.Object
  extended by anl.aida.util.VectorUtilities

public class VectorUtilities
extends java.lang.Object

Date: Feb 13, 2009 11:33:50 AM


Constructor Summary
VectorUtilities()
           
 
Method Summary
static float[] doubleToFloat(double[] vec)
           
static double[] floatToDouble(float[] vec)
           
static float[] normalizeVector(float[] vec)
          Returns the normalized version of a vector, i.e.
static float scalarProduct(float[] vec1, double[] vec2)
          Returns the scalar product (dot product) of two vectors for normalized vectors this is the same as cosine similarity.
static float scalarProduct(float[] vec1, float[] vec2)
          Returns the scalar product (dot product) of two vectors for normalized vectors this is the same as cosine similarity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorUtilities

public VectorUtilities()
Method Detail

scalarProduct

public static float scalarProduct(float[] vec1,
                                  float[] vec2)
Returns the scalar product (dot product) of two vectors for normalized vectors this is the same as cosine similarity.

Parameters:
vec1 - First vector.
vec2 - Second vector.
Returns:
the product

scalarProduct

public static float scalarProduct(float[] vec1,
                                  double[] vec2)
Returns the scalar product (dot product) of two vectors for normalized vectors this is the same as cosine similarity.

Parameters:
vec1 - First vector.
vec2 - Second vector.
Returns:
the product

doubleToFloat

public static float[] doubleToFloat(double[] vec)

floatToDouble

public static double[] floatToDouble(float[] vec)

normalizeVector

public static float[] normalizeVector(float[] vec)
Returns the normalized version of a vector, i.e. same direction, unit length. This does NOT effect the input vector.

Parameters:
vec - Vector whose normalized version is requested.
Returns:
the normalized vector