JSci.maths
Class Double3Vector

java.lang.Object
  extended by JSci.maths.MathVector
      extended by JSci.maths.DoubleVector
          extended by JSci.maths.Double3Vector
All Implemented Interfaces:
java.io.Serializable, BanachSpace.Member, Module.Member, VectorSpace.Member, AbelianGroup.Member, Member

public class Double3Vector
extends DoubleVector

The Double3Vector class encapsulates double 3-vectors.

Version:
2.0
Author:
Mark Hale
See Also:
Serialized Form

Field Summary
 
Fields inherited from class JSci.maths.DoubleVector
ARRAY_1D, vector
 
Fields inherited from class JSci.maths.MathVector
CLASS_SPECIFIC, N, storageFormat
 
Constructor Summary
Double3Vector()
          Constructs an empty 3-vector.
Double3Vector(double[] array)
          Constructs a vector by wrapping an array.
Double3Vector(double x, double y, double z)
          Constructs a 3-vector.
 
Method Summary
 Double3Vector add(Double3Vector v)
          Returns the addition of this vector and another.
 boolean equals(java.lang.Object a)
          Compares two double vectors for equality.
 double getComponent(int n)
          Returns a component of this vector.
 int hashCode()
          Returns a hashcode for this vector.
 double infNorm()
          Returns the linfinity-norm.
 DoubleVector mapComponents(Mapping f)
          Applies a function on all the vector components.
 Double3Vector multiply(Double3Vector v)
          Returns the vector product of this vector and another (so(3) algebra).
 double norm()
          Returns the l2-norm (magnitude).
 double norm(int n)
          Returns the ln-norm.
 DoubleVector scalarDivide(double x)
          Returns the division of this vector by a scalar.
 DoubleVector scalarMultiply(double x)
          Returns the multiplication of this vector by a scalar.
 double scalarProduct(Double3Vector v)
          Returns the scalar product of this vector and another.
 void setComponent(int n, double x)
          Sets the value of a component of this vector.
 Double3Vector subtract(Double3Vector v)
          Returns the subtraction of this vector by another.
 ComplexVector toComplexVector()
          Converts this 3-vector to a complex 3-vector.
 IntegerVector toIntegerVector()
          Converts this 3-vector to an integer 3-vector.
 java.lang.String toString()
          Returns a comma delimited string representing the value of this vector.
 
Methods inherited from class JSci.maths.DoubleVector
add, add, negate, normalize, scalarDivide, scalarMultiply, scalarProduct, subtract, subtract
 
Methods inherited from class JSci.maths.MathVector
dimension, getInvalidComponentMsg
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Double3Vector

public Double3Vector()
Constructs an empty 3-vector.


Double3Vector

public Double3Vector(double[] array)
Constructs a vector by wrapping an array.

Parameters:
array - an assigned value

Double3Vector

public Double3Vector(double x,
                     double y,
                     double z)
Constructs a 3-vector.

Parameters:
x - x coordinate
y - y coordinate
z - z coordinate
Method Detail

equals

public boolean equals(java.lang.Object a)
Compares two double vectors for equality.

Overrides:
equals in class DoubleVector
Parameters:
a - a double 3-vector

toString

public java.lang.String toString()
Returns a comma delimited string representing the value of this vector.

Overrides:
toString in class DoubleVector

hashCode

public int hashCode()
Returns a hashcode for this vector.

Overrides:
hashCode in class DoubleVector

toIntegerVector

public IntegerVector toIntegerVector()
Converts this 3-vector to an integer 3-vector.

Overrides:
toIntegerVector in class DoubleVector
Returns:
an integer 3-vector

toComplexVector

public ComplexVector toComplexVector()
Converts this 3-vector to a complex 3-vector.

Overrides:
toComplexVector in class DoubleVector
Returns:
a complex 3-vector

getComponent

public double getComponent(int n)
Returns a component of this vector.

Overrides:
getComponent in class DoubleVector
Parameters:
n - index of the vector component
Throws:
VectorDimensionException - If attempting to access an invalid component.

setComponent

public void setComponent(int n,
                         double x)
Sets the value of a component of this vector.

Overrides:
setComponent in class DoubleVector
Parameters:
n - index of the vector component
x - a number
Throws:
VectorDimensionException - If attempting to access an invalid component.

norm

public double norm(int n)
Returns the ln-norm.

Overrides:
norm in class DoubleVector

norm

public double norm()
Returns the l2-norm (magnitude).

Specified by:
norm in interface BanachSpace.Member
Overrides:
norm in class DoubleVector

infNorm

public double infNorm()
Returns the linfinity-norm.

Overrides:
infNorm in class DoubleVector

add

public Double3Vector add(Double3Vector v)
Returns the addition of this vector and another.

Parameters:
v - a double 3-vector

subtract

public Double3Vector subtract(Double3Vector v)
Returns the subtraction of this vector by another.

Parameters:
v - a double 3-vector

scalarMultiply

public DoubleVector scalarMultiply(double x)
Returns the multiplication of this vector by a scalar.

Overrides:
scalarMultiply in class DoubleVector
Parameters:
x - a double
Returns:
a double 3-vector

scalarDivide

public DoubleVector scalarDivide(double x)
Returns the division of this vector by a scalar.

Overrides:
scalarDivide in class DoubleVector
Parameters:
x - a double
Returns:
a double 3-vector
Throws:
java.lang.ArithmeticException - If divide by zero.

scalarProduct

public double scalarProduct(Double3Vector v)
Returns the scalar product of this vector and another.

Parameters:
v - a double 3-vector

multiply

public Double3Vector multiply(Double3Vector v)
Returns the vector product of this vector and another (so(3) algebra).

Parameters:
v - a double 3-vector

mapComponents

public DoubleVector mapComponents(Mapping f)
Applies a function on all the vector components.

Overrides:
mapComponents in class DoubleVector
Parameters:
f - a user-defined function
Returns:
a double 3-vector