mfc.vector
Class Complex2

java.lang.Object
  extended bymfc.vector.Complex2
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
ComplexProjective1

public class Complex2
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class represents a complex 2-vector

 [  a  ]     [ aRe + i aIm ] 
 [  b  ]  =  [ bRe + i bIm ]
 

To minimize the object count its 2 complex entries a,b are represented by 4 double values aRe, aIm, bRe, bIm. All methods avoid the creation of temporarily used objects in their internal computations unless stated in their describtions.

Creation of many temporarily used instances is expensive and stresses the garabage collector. This can cause your java program to be slow and should therefore be avoided. Thus, operations which result in an instance of Complex can be performed either with or without creating a vector. To compute, for example, the product of matrix with a vector you can either use

 Complex2 v = m.times( w ),
 
or
 v.assignTimes( m, w ).
 
This philosophy is applied to operations which result in other instances, as well. In such a case an instance of the resulting type can be prescribed as a parameter which is than filled by the method.

See Also:
Serialized Form

Field Summary
 double aIm
          entry of the vector
 double aRe
          entry of the vector
 double bIm
          entry of the vector
 double bRe
          entry of the vector
protected static double EPS
          threashold for zero tests; default is 1e-14
 
Constructor Summary
  Complex2()
          creates zero vector
  Complex2(Complex2 v)
          creates a vector equal to the prescribed one
protected Complex2(Complex a, Complex b)
          creates a vector with the prescribed entries
  Complex2(double aRe, double aIm, double bRe, double bIm)
          creates a vector with the prescribed entries
 
Method Summary
 void assign(Complex2 s)
          assigns this with the prescribed vector
 void assign(Complex a, Complex b)
          assigns this with the prescribed entries
 void assign(double aRe, double aIm, double bRe, double bIm)
          assigns this with the prescribed entries
 void assignTimes(AbstractComplex2By2 m, Complex2 v)
          assign this with product of matrix m and vector v.
 void assignTimes(Complex z, Complex2 v)
          Assign this with the product of a complex number and a complex 2-vector.
 void assignZero()
          assigns this with zero
 Complex2 copy()
          returns copy of this
 Complex getA()
          returns entry a of this
 void getA(Complex a)
          assigns a with entry a of this
 Complex getB()
          returns entry b of this
 void getB(Complex b)
          assigns b with entry b of this
 void setA(Complex a)
          sets entry a of this with a
 void setB(Complex b)
          sets entry b of this with b
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EPS

protected static final double EPS
threashold for zero tests; default is 1e-14

See Also:
Constant Field Values

aRe

public double aRe
entry of the vector


aIm

public double aIm
entry of the vector


bRe

public double bRe
entry of the vector


bIm

public double bIm
entry of the vector

Constructor Detail

Complex2

public Complex2()
creates zero vector


Complex2

public Complex2(double aRe,
                double aIm,
                double bRe,
                double bIm)
creates a vector with the prescribed entries


Complex2

protected Complex2(Complex a,
                   Complex b)
creates a vector with the prescribed entries


Complex2

public Complex2(Complex2 v)
creates a vector equal to the prescribed one

Method Detail

assignZero

public void assignZero()
assigns this with zero


assign

public void assign(double aRe,
                   double aIm,
                   double bRe,
                   double bIm)
assigns this with the prescribed entries


getA

public final Complex getA()
returns entry a of this


getA

public final void getA(Complex a)
assigns a with entry a of this

Parameters:
a - complex value which is assigned with entry a.

setA

public final void setA(Complex a)
sets entry a of this with a


getB

public final Complex getB()
returns entry b of this


getB

public final void getB(Complex b)
assigns b with entry b of this

Parameters:
b - complex value which is assigned with entry b.

setB

public final void setB(Complex b)
sets entry b of this with b


copy

public final Complex2 copy()
returns copy of this


assign

public final void assign(Complex a,
                         Complex b)
assigns this with the prescribed entries


assign

public final void assign(Complex2 s)
assigns this with the prescribed vector


assignTimes

public final void assignTimes(AbstractComplex2By2 m,
                              Complex2 v)
assign this with product of matrix m and vector v.


assignTimes

public final void assignTimes(Complex z,
                              Complex2 v)
Assign this with the product of a complex number and a complex 2-vector.


toString

public java.lang.String toString()