com.rapidminer.tools.math
Class VectorMath

java.lang.Object
  extended by com.rapidminer.tools.math.VectorMath

public class VectorMath
extends java.lang.Object

This class provides basic operations on vectors like subtraction, multiply and division.

Author:
Regina Fritsch

Constructor Summary
VectorMath()
           
 
Method Summary
static double getMedian(double[] residuals)
          This method returns the median value of the given double array.
static int getPolynomialExpansionSize(int numberOfComponents, int degree)
          This method returns the number of dimensions, a vector will have after a polynomial expansion.
static double[][] matrixDivision(double[][] x, double y)
           
static double[] polynomialExpansion(double[] x, int degree)
          This method expands the given vector with the polynomial bases of the given degree.
static double[] vectorAddition(double[] x, double[] y)
           
static double[] vectorDivision(double[] x, double y)
           
static double[] vectorMultiplication(double[] x, double y)
           
static double vectorMultiplication(double[] vec1, double[] vec2)
           
static double[] vectorSubtraction(double[] x, double[] y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorMath

public VectorMath()
Method Detail

vectorSubtraction

public static final double[] vectorSubtraction(double[] x,
                                               double[] y)

vectorAddition

public static final double[] vectorAddition(double[] x,
                                            double[] y)

vectorMultiplication

public static final double vectorMultiplication(double[] vec1,
                                                double[] vec2)

vectorMultiplication

public static final double[] vectorMultiplication(double[] x,
                                                  double y)

vectorDivision

public static final double[] vectorDivision(double[] x,
                                            double y)

matrixDivision

public static final double[][] matrixDivision(double[][] x,
                                              double y)

polynomialExpansion

public static final double[] polynomialExpansion(double[] x,
                                                 int degree)
This method expands the given vector with the polynomial bases of the given degree. For example if degree is 2 and the vector x consists of 2 components x1, x2, the result would be: 1, x1, x2, x1^2, x1x2, x2^2 So the constant 1 will always be added, do not include it into x!


getPolynomialExpansionSize

public static final int getPolynomialExpansionSize(int numberOfComponents,
                                                   int degree)
This method returns the number of dimensions, a vector will have after a polynomial expansion.


getMedian

public static final double getMedian(double[] residuals)
This method returns the median value of the given double array. This is a slow implementation, because one sorting is needed. TODO : Implementing using fast linear time algorithm



Copyright © 2001-2009 by Rapid-I