© 2006-2007 ETH Zurich

org.ximtec.igesture.util
Class BDVectorTools

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

public class BDVectorTools
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
BDVectorTools()
           
 
Method Summary
static BigDecimalVector add(BigDecimalVector v1, BigDecimalVector v2)
          Performs an addition of two double vectors.
static boolean hasValidValues(BigDecimalVector vector)
          Tests if all values in the vector are valid.
static void init(BigDecimalVector vector, BigDecimal initValue)
          Initialises the vector with a given value.
static BigDecimalVector mean(Collection<BigDecimalVector> vectors)
          Computes the mean vector of a set of vectors.
static BigDecimalVector normalize(BigDecimalVector vector)
          Normalises a vector (LP norm is used).
static BigDecimal normLP(BigDecimalVector vector)
          Computes the LP norm of the vector.
static BigDecimalVector scalarDiv(BigDecimalVector vector, int divisor)
          Computes the scalar division of a double vector.
static BigDecimalVector sum(Collection<BigDecimalVector> 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

BDVectorTools

public BDVectorTools()
Method Detail

add

public static BigDecimalVector add(BigDecimalVector v1,
                                   BigDecimalVector 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(BigDecimalVector vector,
                        BigDecimal initValue)
Initialises the vector with a given value.

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

scalarDiv

public static BigDecimalVector scalarDiv(BigDecimalVector vector,
                                         int 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 BigDecimalVector sum(Collection<BigDecimalVector> 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 BigDecimalVector mean(Collection<BigDecimalVector> 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 BigDecimal normLP(BigDecimalVector 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 BigDecimalVector normalize(BigDecimalVector vector)
Normalises a vector (LP norm is used).

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

hasValidValues

public static boolean hasValidValues(BigDecimalVector 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.