Statistics
Class Vector

java.lang.Object
  extended byStatistics.Vector

public class Vector
extends java.lang.Object

Provides static methods for component by component operations on double[ ]s. Used in the class RandomVector. No vector objects are intended to be instantiated. Vectors are treated as double[ ]s.

WARNING: in binary operations both doubles[ ] must be of the same length but this is not checked. The first double[ ] determines the dimension of the result. If it is shorter than the second double[ ] this leads to truncation if it is longer to an OutOfBoundsException.


Constructor Summary
Vector()
           
 
Method Summary
static double[] add(double[] X, double[] Y)
          Adds Y to X and returns the updated double[ ] X.
static double[] mult(double[] X, double[] Y)
          Componentwise multiplication.
static void print(double[] X)
          Componentwise square root.
static double[] scalarMult(double f, double[] X)
          Scalar multiplication.
static void setZero(double[] X)
          Sets all components of the vector X equal to zero.
static double[] sqrt(double[] X)
          Componentwise square root.
static double[] subtract(double[] X, double[] Y)
          Subtracts Y from X and returns the updated double[ ] X.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Vector

public Vector()
Method Detail

setZero

public static void setZero(double[] X)

Sets all components of the vector X equal to zero.


add

public static double[] add(double[] X,
                           double[] Y)

Adds Y to X and returns the updated double[ ] X.


subtract

public static double[] subtract(double[] X,
                                double[] Y)

Subtracts Y from X and returns the updated double[ ] X.


mult

public static double[] mult(double[] X,
                            double[] Y)

Componentwise multiplication. Multiplies the components of X with the corresponding components of Y and returns the updated double[ ] X.


scalarMult

public static double[] scalarMult(double f,
                                  double[] X)

Scalar multiplication. Multiplies the components of X with the scalar f and returns the updated double[ ] X.


sqrt

public static double[] sqrt(double[] X)

Componentwise square root. Replaces each component of X with its square root and returns the updated double[ ] X.


print

public static void print(double[] X)

Componentwise square root. Replaces each component of X with its square root and returns the updated double[ ] X.