JSci.maths
Class Complex3Vector

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

public class Complex3Vector
extends ComplexVector

The Complex3Vector class encapsulates complex 3-vectors.

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

Field Summary
 
Fields inherited from class JSci.maths.ComplexVector
ARRAY_1D, vectorIm, vectorRe
 
Fields inherited from class JSci.maths.MathVector
CLASS_SPECIFIC, N, storageFormat
 
Constructor Summary
Complex3Vector()
          Constructs an empty 3-vector.
Complex3Vector(Complex x, Complex y, Complex z)
          Constructs a 3-vector.
Complex3Vector(double[] real, double[] imag)
          Constructs a 3-vector by wrapping two arrays.
 
Method Summary
 Complex3Vector add(Complex3Vector v)
          Returns the addition of this vector and another.
 Complex3Vector add(Double3Vector v)
          Returns the addition of this vector and another.
 Complex3Vector add(Integer3Vector v)
          Returns the addition of this vector and another.
 ComplexVector conjugate()
          Returns the complex conjugate of this vector.
 boolean equals(java.lang.Object a)
          Compares two complex vectors for equality.
 Complex getComponent(int n)
          Returns a component of this vector.
 int hashCode()
          Returns a hashcode for this vector.
 DoubleVector imag()
          Returns the imaginary part of this complex 3-vector.
 double infNorm()
          Returns the linfinity-norm.
 ComplexVector mapComponents(ComplexMapping f)
          Applies a function on all the vector components.
 Complex3Vector multiply(Complex3Vector v)
          Returns the vector product of this vector and another.
 double norm()
          Returns the l2-norm (magnitude).
 DoubleVector real()
          Returns the real part of this complex 3-vector.
 ComplexVector scalarDivide(Complex z)
          Returns the division of this vector by a scalar.
 ComplexVector scalarDivide(double x)
          Returns the division of this vector by a scalar.
 ComplexVector scalarMultiply(Complex z)
          Returns the multiplication of this vector by a scalar.
 ComplexVector scalarMultiply(double x)
          Returns the multiplication of this vector by a scalar.
 Complex scalarProduct(Complex3Vector v)
          Returns the scalar product of this vector and another.
 void setComponent(int n, Complex z)
          Sets the value of a component of this vector.
 void setComponent(int n, double x, double y)
          Sets the value of a component of this vector.
 Complex3Vector subtract(Complex3Vector v)
          Returns the subtraction of this vector by another.
 Complex3Vector subtract(Double3Vector v)
          Returns the subtraction of this vector by another.
 Complex3Vector subtract(Integer3Vector v)
          Returns the subtraction of this vector by another.
 java.lang.String toString()
          Returns a comma delimited string representing the value of this vector.
 
Methods inherited from class JSci.maths.ComplexVector
add, add, add, add, negate, normalize, scalarDivide, scalarMultiply, scalarProduct, scalarProduct, subtract, subtract, 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

Complex3Vector

public Complex3Vector()
Constructs an empty 3-vector.


Complex3Vector

public Complex3Vector(double[] real,
                      double[] imag)
Constructs a 3-vector by wrapping two arrays.

Parameters:
real - an array of real values
imag - an array of imaginary values

Complex3Vector

public Complex3Vector(Complex x,
                      Complex y,
                      Complex 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 complex vectors for equality.

Overrides:
equals in class ComplexVector
Parameters:
a - a complex 3-vector

toString

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

Overrides:
toString in class ComplexVector

hashCode

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

Overrides:
hashCode in class ComplexVector

real

public DoubleVector real()
Returns the real part of this complex 3-vector.

Overrides:
real in class ComplexVector

imag

public DoubleVector imag()
Returns the imaginary part of this complex 3-vector.

Overrides:
imag in class ComplexVector

getComponent

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

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

setComponent

public void setComponent(int n,
                         Complex z)
Sets the value of a component of this vector. Should only be used to initialise this vector.

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

setComponent

public void setComponent(int n,
                         double x,
                         double y)
Sets the value of a component of this vector. Should only be used to initialise this vector.

Overrides:
setComponent in class ComplexVector
Parameters:
n - index of the vector component
x - the real part of a complex number
y - the imaginary part of a complex number
Throws:
VectorDimensionException - If attempting to access an invalid component.

norm

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

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

infNorm

public double infNorm()
Returns the linfinity-norm.

Overrides:
infNorm in class ComplexVector

conjugate

public ComplexVector conjugate()
Returns the complex conjugate of this vector.

Overrides:
conjugate in class ComplexVector
Returns:
a complex 3-vector

add

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

Parameters:
v - a complex 3-vector

add

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

Parameters:
v - a double 3-vector

add

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

Parameters:
v - an integer 3-vector

subtract

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

Parameters:
v - a complex 3-vector

subtract

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

Parameters:
v - a double 3-vector

subtract

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

Parameters:
v - an integer 3-vector

scalarMultiply

public ComplexVector scalarMultiply(Complex z)
Returns the multiplication of this vector by a scalar.

Overrides:
scalarMultiply in class ComplexVector
Parameters:
z - a complex number
Returns:
a complex 3-vector

scalarMultiply

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

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

scalarDivide

public ComplexVector scalarDivide(Complex z)
Returns the division of this vector by a scalar.

Overrides:
scalarDivide in class ComplexVector
Parameters:
z - a complex number
Returns:
a complex 3-vector
Throws:
java.lang.ArithmeticException - If divide by zero.

scalarDivide

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

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

scalarProduct

public Complex scalarProduct(Complex3Vector v)
Returns the scalar product of this vector and another.

Parameters:
v - a complex 3-vector

multiply

public Complex3Vector multiply(Complex3Vector v)
Returns the vector product of this vector and another.

Parameters:
v - a complex 3-vector

mapComponents

public ComplexVector mapComponents(ComplexMapping f)
Applies a function on all the vector components.

Overrides:
mapComponents in class ComplexVector
Parameters:
f - a user-defined function
Returns:
a complex 3-vector