org.jscience.chemistry.quantum.math.vector
Class VectorND

java.lang.Object
  extended by org.jscience.chemistry.quantum.math.vector.VectorND
All Implemented Interfaces:
java.lang.Cloneable

public class VectorND
extends java.lang.Object
implements java.lang.Cloneable

Defines an R^n space vector.


Field Summary
protected  int size
          Holds value of property size.
protected  double[] vector
          Holds value of property vector.
 
Constructor Summary
VectorND(double[] array)
          Creates a new VectorND object.
VectorND(int size)
          Creates a new instance of Vector
VectorND(Matrix a)
          Creates a new instance of Vector from a square Matrix
 
Method Summary
 VectorND add(VectorND b)
          addition of two vectors
 java.lang.Object clone()
          clone this vector ;) Cloning is getting interesting!
 double dot(VectorND b)
          The dot product of two vectors (a.b)
 int getSize()
          Getter for property size.
 double[] getVector()
          Getter for property vector.
 double getVector(int index)
          Indexed getter for property vector.
 double magnitude()
          The magnitude of this vector
 void makeZero()
          Make this vector a Null vector
 VectorND mul(double k)
          multiplication of this vector with a scalar k
 VectorND negate()
          negate this vector
 VectorND normalize()
          get the normalized form of this vector
 void setSize(int size)
          Setter for property size.
 void setVector(double[] vector)
          Setter for property vector.
 void setVector(int index, double vector)
          Indexed setter for property vector.
 VectorND sub(VectorND b)
          substraction of two vectors (this - b)
 java.lang.String toString()
          the overridden toString() method
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

protected int size
Holds value of property size.


vector

protected double[] vector
Holds value of property vector.

Constructor Detail

VectorND

public VectorND(int size)
Creates a new instance of Vector

Parameters:
size - DOCUMENT ME!

VectorND

public VectorND(double[] array)
Creates a new VectorND object.

Parameters:
array - DOCUMENT ME!

VectorND

public VectorND(Matrix a)
Creates a new instance of Vector from a square Matrix

Parameters:
a - the square matrix from which this vector will be made
Method Detail

makeZero

public void makeZero()
Make this vector a Null vector


getSize

public int getSize()
Getter for property size.

Returns:
Value of property size.

setSize

public void setSize(int size)
Setter for property size.

Parameters:
size - New value of property size.

getVector

public double getVector(int index)
Indexed getter for property vector.

Parameters:
index - Index of the property.
Returns:
Value of the property at index.

getVector

public double[] getVector()
Getter for property vector.

Returns:
Value of property vector.

setVector

public void setVector(int index,
                      double vector)
Indexed setter for property vector.

Parameters:
index - Index of the property.
vector - New value of the property at index.

setVector

public void setVector(double[] vector)
Setter for property vector.

Parameters:
vector - New value of property vector.

add

public VectorND add(VectorND b)
addition of two vectors

Parameters:
b - : to be added to the current vector
Returns:
the addition of two vector or null if that is not possible

sub

public VectorND sub(VectorND b)
substraction of two vectors (this - b)

Parameters:
b - : to be substracted from the current vector
Returns:
the addition of two vector or null if that is not possible

mul

public VectorND mul(double k)
multiplication of this vector with a scalar k

Parameters:
k - k : the scalar to be multiplied to this vector
Returns:
the result !

dot

public double dot(VectorND b)
The dot product of two vectors (a.b)

Parameters:
b - vector with which the dot product is to be evaluated
Returns:
a double value which is the result of the dot product

magnitude

public double magnitude()
The magnitude of this vector

Returns:
the magnitude (length) of this vector.

normalize

public VectorND normalize()
get the normalized form of this vector

Returns:
the normalized form of this vector

negate

public VectorND negate()
negate this vector

Returns:
the reverse vector

clone

public java.lang.Object clone()
clone this vector ;) Cloning is getting interesting! :)

Overrides:
clone in class java.lang.Object
Returns:
the clone

toString

public java.lang.String toString()
the overridden toString() method

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!