© 2006-2007 ETH Zurich

org.ximtec.igesture.util
Class VectorTools

java.lang.Object
  extended by org.ximtec.igesture.util.VectorTools

public class VectorTools
extends Object

Static methods operating on the DoubleVector class.

Version:
1.0, Dec 2006
Author:
Ueli Kurmann, igesture@uelikurmann.ch, Beat Signer, signer@inf.ethz.ch

Constructor Summary
VectorTools()
           
 
Method Summary
static DoubleVector add(DoubleVector v1, DoubleVector v2)
          Performs an addition of two double vectors.
static boolean hasValidValues(DoubleVector vector)
          Tests if all values in the vector are valid.
static void init(DoubleVector vector, double initValue)
          Initialises the vector with a given value.
static DoubleVector mean(Collection<DoubleVector> vectors)
          Computes the mean vector of a set of vectors.
static DoubleVector normalize(DoubleVector vector)
          Normalises a vector (LP norm is used).
static double normLP(DoubleVector vector)
          Computes the LP norm of the vector.
static DoubleVector scalarDiv(DoubleVector vector, double divisor)
          Computes the scalar division of a double vector.
static DoubleVector sum(Collection<DoubleVector> vectors)
          Computes the sum of a collection of double vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorTools

public VectorTools()
Method Detail

add

public static DoubleVector add(DoubleVector v1,
                               DoubleVector v2)
Performs an addition of two double vectors.

Parameters:
v1 - the first vector.
v2 - the second vector.
Returns:
the sum of the two vectors.

init

public static void init(DoubleVector vector,
                        double initValue)
Initialises the vector with a given value.

Parameters:
vector - the vector to be initialised.
initValue - the initialisation value.

scalarDiv

public static DoubleVector scalarDiv(DoubleVector vector,
                                     double divisor)
Computes the scalar division of a double vector.

Parameters:
vector - the vector.
divisor - the divisor.
Returns:
the vector divided by divisor.

sum

public static DoubleVector sum(Collection<DoubleVector> vectors)
Computes the sum of a collection of double vectors. By contract the size of all vectors must be the same.

Parameters:
vectors - a collection of double vectors.
Returns:
a double vector containing the sum of all vectors.

mean

public static DoubleVector mean(Collection<DoubleVector> vectors)
Computes the mean vector of a set of vectors.

Parameters:
vectors - the collection of double vectors whose mean vector has to be computed.
Returns:
the mean vector of the specified set of vectors.

normLP

public static double normLP(DoubleVector vector)
Computes the LP norm of the vector.

Parameters:
vector - the vector to compute the LP norm.
Returns:
the LP norm of the vector.

normalize

public static DoubleVector normalize(DoubleVector vector)
Normalises a vector (LP norm is used).

Parameters:
vector - the vector to be normalised.
Returns:
the normalised vector.

hasValidValues

public static boolean hasValidValues(DoubleVector vector)
Tests if all values in the vector are valid. (not NaN, Infinite)

Parameters:
vector - the vector to test.
Returns:
true if all values are valid.

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.