org.mymedialite.datatype
Class VectorExtensions

java.lang.Object
  extended by org.mymedialite.datatype.VectorExtensions

public class VectorExtensions
extends java.lang.Object

Extensions for vector-like data.


Method Summary
static double euclideanNorm(java.util.Collection<java.lang.Double> vector)
          Compute the Euclidean norm of a collection of doubles.
static double euclideanNorm(double[] vector)
          Compute the Euclidean norm of an array of doubles
static void initNormal(java.util.List<java.lang.Double> vector, double mean, double stddev)
          Initialize a collection of doubles with values from a normal distribution.
static double L1Norm(java.util.Collection<java.lang.Double> vector)
          Compute the L1 norm of a collection of doubles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

euclideanNorm

public static double euclideanNorm(java.util.Collection<java.lang.Double> vector)
Compute the Euclidean norm of a collection of doubles.

Parameters:
vector - the vector to compute the norm for
Returns:
the Euclidean norm of the vector

euclideanNorm

public static double euclideanNorm(double[] vector)
Compute the Euclidean norm of an array of doubles

Parameters:
vector - the vector to compute the norm for
Returns:
the Euclidean norm of the vector

L1Norm

public static double L1Norm(java.util.Collection<java.lang.Double> vector)
Compute the L1 norm of a collection of doubles.

Parameters:
vector - the vector to compute the norm for
Returns:
the L1 norm of the vector

initNormal

public static void initNormal(java.util.List<java.lang.Double> vector,
                              double mean,
                              double stddev)
Initialize a collection of doubles with values from a normal distribution.

Parameters:
vector - the vector to initialize
mean - the mean of the normal distribution
stddev - the standard deviation of the normal distribution