mfc.matrix
Class Complex2By2

java.lang.Object
  extended bymfc.matrix.AbstractComplex2By2
      extended bymfc.matrix.Complex2By2
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Complex2By2
extends AbstractComplex2By2
implements java.io.Serializable, java.lang.Cloneable

This class represents a complex 2-by-2 matrix.

 [  a   b  ]     [  aRe + i aIm      bRe + i bIm  ] 
 [         ]  =  [                                ]
 [  c   d  ]     [  dRe + i dIm      dRe + i dIm  ] 
 

To minimize the object count its 4 complex entries a,b,c,d are represented by 8 double values aRe, aIm, bRe, bIm, cRe, cIm, dRe, dIm. 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 Complex2By2 can be performed either with or without creating a matrix. To compute, for example, the product of two matrices you can either use

 Complex2By2 m = a.times( b ),
 
or
 m.assignTimes( a, b ).
 
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. To compute the eigenvalues of a matrix, for example, m you can use either
 double[] ev = m.getEigenValues()
 
or
 m.getEigenValues( ev )
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class mfc.matrix.AbstractComplex2By2
aIm, aRe, bIm, bRe, cIm, cRe, dIm, dRe, EPS, EPSILON, EPSSQR
 
Constructor Summary
Complex2By2()
          creates an identity matrix
Complex2By2(AbstractComplex2By2 m)
          creates a matrix equal to the prescribed one
Complex2By2(Complex a, Complex b, Complex c, Complex d)
          creates a matrix with the prescribed entries
Complex2By2(double aRe, double aIm, double bRe, double bIm, double cRe, double cIm, double dRe, double dIm)
          creates a matrix with the prescribed entries
 
Method Summary
 Complex2By2 adjoined()
          returns the adjoined of this
 Complex2By2 adjugate()
          returns the adjugate of this
 void assign(AbstractComplex2By2 s)
          assigns this with the prescribed matrix
 void assign(Complex a, Complex b, Complex c, Complex d)
          assigns this with the prescribed entries
 void assign(double aRe, double aIm, double bRe, double bIm, double cRe, double cIm, double dRe, double dIm)
          assigns this with the prescribed entries
 void assignAdjoined()
          assigns this with its own adjoined
 void assignAdjoined(AbstractComplex2By2 a)
          assigns this with the adjoined of a
 void assignAdjoinedWith(AbstractComplex2By2 t)
          Assign this with t this t*.
 void assignAdjugate()
          assigns this with its own adjugate
 void assignAdjugate(AbstractComplex2By2 a)
          assigns this with the adjugate of a
 void assignAsEigenvectorMatrixOf(HermitianComplex2By2 m)
           
 void assignByColumn(Complex2 column1, Complex2 column2)
          Assign this by column.
 void assignByEigenvectors(Complex eigenvalue1, Complex2 eigenvector1, Complex eigenvalue2, Complex2 eigenvector2)
          Assign this by prescribing eigenvectors and eigenvalues.
 void assignByEigenvectors(double eigenvalue1Re, double eigenvalue1Im, Complex2 eigenvector1, double eigenvalue2Re, double eigenvalue2Im, Complex2 eigenvector2)
          Assign this by prescribing eigenvectors and eigenvalues.
 void assignConjugate()
          assigns this with its own conjugate
 void assignConjugate(AbstractComplex2By2 a)
          assigns this with the conjugateative of a
 void assignDivide(AbstractComplex2By2 m)
          assigns this with the product of itself and inverse of m
 void assignDivide(AbstractComplex2By2 a, AbstractComplex2By2 b)
          assigns this with the product of a and inverse of b
 void assignDivide(AbstractComplex2By2 m, Complex z)
          assigns this with the product of m and 1/z
 void assignDivide(AbstractComplex2By2 m, double r)
          assigns this with product of m and 1/r
 void assignDivide(AbstractComplex2By2 m, double x, double y)
          assigns this with the product of m and 1/(x+iy)
 void assignDivide(Complex z)
          assigns this with the product of itself and 1/z
 void assignDivide(double r)
          assigns this with product of itself and 1/r
 void assignDivide(double x, double y)
          assigns this with the product of itself and 1/(x+iy)
 void assignIdentity()
          assigns this with the identity matrix
 void assignInvert()
          assigns this with its own inverse
 void assignInvert(AbstractComplex2By2 m)
          assigns this with the inverse of m
 void assignMinus(AbstractComplex2By2 a)
          subtracts a from this
 void assignMinus(AbstractComplex2By2 a, AbstractComplex2By2 b)
          subtracts b from a and stores the result it this
 void assignMinus(AbstractComplex2By2 m, Complex z)
          subtracts z to all entries of m and and assigns this with the result.
 void assignMinus(AbstractComplex2By2 m, double x)
          subtracts x from all entries of m and and assigns this with the result.
 void assignMinus(AbstractComplex2By2 m, double x, double y)
          subtracts x+iy to all entries of m and and assigns this with the result.
 void assignMinus(Complex z)
          subtracts z from all entries of this
 void assignMinus(double x)
          subtracts x from all entries of this
 void assignMinus(double x, double y)
          subtracts x+iy to all entries of this
 void assignNeg()
          assigns this with its own negative
 void assignNeg(AbstractComplex2By2 a)
          assigns this with the negative of a
 void assignNormalizeDeterminant()
          normalizes (determinant equals 1) this
 void assignNormalizeDeterminant(AbstractComplex2By2 m)
          assigns this with m and normalizes (determinant equals 1) it
 void assignPlus(AbstractComplex2By2 a)
          assigns this with the sum of itself and a
 void assignPlus(AbstractComplex2By2 a, AbstractComplex2By2 b)
          assigns this with the sum of a and b
 void assignPlus(AbstractComplex2By2 m, Complex z)
          adds z to all entries of m and and assigns this with the result.
 void assignPlus(AbstractComplex2By2 m, double x)
          adds x to all entries of m and and assigns this with the result.
 void assignPlus(AbstractComplex2By2 m, double x, double y)
          adds x+iy to all entries of m and and assigns this with the result.
 void assignPlus(Complex z)
          adds z to all entries of this
 void assignPlus(double x)
          adds x to all entries of this
 void assignPlus(double x, double y)
          adds x+iy to all entries of this
 void assignStar()
          assigns this with its own transposed and conjugated
 void assignStar(AbstractComplex2By2 a)
          assigns this with the transposed and conjugated of a
 void assignTimes(AbstractComplex2By2 a)
          assigns this with the product of itself and a
 void assignTimes(AbstractComplex2By2 a, AbstractComplex2By2 b)
          assigns this with the product of a and b
 void assignTimes(AbstractComplex2By2 m, Complex z)
          assigns this with product of m and z
 void assignTimes(AbstractComplex2By2 m, double r)
          assigns this with product of m and r
 void assignTimes(AbstractComplex2By2 m, double x, double y)
          assigns this with the product of m and x+iy
 void assignTimes(Complex z)
          returns the product of this and z
 void assignTimes(double r)
          assigns this with the product of itself and r
 void assignTimes(double x, double y)
          assigns this with the product of itself and x+iy
 void assignTranspose()
          assigns this with its own transposed
 void assignTranspose(AbstractComplex2By2 a)
          assigns this with the transposed of a
 void assignZero()
          assigns this with the zero matrix
 Complex2By2 conjugate()
          returns conjugate of this
 Complex2By2 copy()
          returns copy of this
 Complex2By2 divide(AbstractComplex2By2 a)
          returns the product of this and inverse of a
 Complex2By2 divide(Complex z)
          returns the product of this and 1/z
 Complex2By2 divide(double r)
          returns the product of this and 1/r
 Complex2By2 divide(double x, double y)
          returns the product of this and 1/(x+iy)
 Complex2By2 invert()
          returns inverse of this
 Complex2By2 minus(AbstractComplex2By2 a)
          subtracts a from this and returns the result
 Complex2By2 minus(Complex z)
          subtracts z from all entries of this and returns the result
 Complex2By2 minus(double x)
          subtracts x from all entries of this and returns the result
 Complex2By2 minus(double x, double y)
          subtracts x+iy from all entries of this and returns the result
 Complex2By2 neg()
          returns negative of this
 Complex2By2 normalizeDeterminant()
          returns a normalized (determiant equals 1) copy of this
 Complex2By2 plus(AbstractComplex2By2 a)
          returns this with the sum of this and a
 Complex2By2 plus(Complex z)
          adds z to all entries of this and returns the result
 Complex2By2 plus(double x)
          adds x to all entries of this and returns the result
 Complex2By2 plus(double x, double y)
          adds x+iy to all entries of this and returns the result
 void setA(Complex a)
          sets entry a of this with a
 void setB(Complex b)
          sets entry b of this with b
 void setC(Complex c)
          sets entry c of this with c
 void setD(Complex d)
          sets entry d of this with d
 Complex2By2 star()
          returns transposed and conjugated of this
 Complex2By2 times(AbstractComplex2By2 a)
          returns the product of this and a
 Complex2By2 times(Complex z)
          returns the product of this and z
 Complex2By2 times(double r)
          returns the product of this and r
 Complex2By2 times(double x, double y)
          returns product of this and x+iy
 Complex2By2 transpose()
          returns transposed of this
 
Methods inherited from class mfc.matrix.AbstractComplex2By2
abs, absSqr, assignConjugateWith, determinant, determinant, dist, distSqr, divide, equals, getA, getA, getB, getB, getC, getC, getD, getD, getEigenValues, getEigenValues, getEigenValues, minus, norm, normSqr, plus, times, times, toString, trace, trace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Complex2By2

public Complex2By2()
creates an identity matrix


Complex2By2

public Complex2By2(double aRe,
                   double aIm,
                   double bRe,
                   double bIm,
                   double cRe,
                   double cIm,
                   double dRe,
                   double dIm)
creates a matrix with the prescribed entries


Complex2By2

public Complex2By2(Complex a,
                   Complex b,
                   Complex c,
                   Complex d)
creates a matrix with the prescribed entries


Complex2By2

public Complex2By2(AbstractComplex2By2 m)
creates a matrix equal to the prescribed one

Method Detail

setA

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

Overrides:
setA in class AbstractComplex2By2

setB

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

Overrides:
setB in class AbstractComplex2By2

setC

public final void setC(Complex c)
sets entry c of this with c

Overrides:
setC in class AbstractComplex2By2

setD

public final void setD(Complex d)
sets entry d of this with d

Overrides:
setD in class AbstractComplex2By2

copy

public final Complex2By2 copy()
returns copy of this


assignZero

public final void assignZero()
assigns this with the zero matrix

Overrides:
assignZero in class AbstractComplex2By2

assignIdentity

public final void assignIdentity()
assigns this with the identity matrix

Overrides:
assignIdentity in class AbstractComplex2By2

assign

public final void assign(double aRe,
                         double aIm,
                         double bRe,
                         double bIm,
                         double cRe,
                         double cIm,
                         double dRe,
                         double dIm)
assigns this with the prescribed entries

Overrides:
assign in class AbstractComplex2By2

assign

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

Overrides:
assign in class AbstractComplex2By2

assign

public final void assign(AbstractComplex2By2 s)
assigns this with the prescribed matrix

Overrides:
assign in class AbstractComplex2By2

assignTimes

public final void assignTimes(AbstractComplex2By2 a)
assigns this with the product of itself and a

Overrides:
assignTimes in class AbstractComplex2By2

assignTimes

public final void assignTimes(AbstractComplex2By2 a,
                              AbstractComplex2By2 b)
assigns this with the product of a and b

Overrides:
assignTimes in class AbstractComplex2By2

times

public final Complex2By2 times(AbstractComplex2By2 a)
returns the product of this and a


assignTimes

public final void assignTimes(double r)
assigns this with the product of itself and r

Overrides:
assignTimes in class AbstractComplex2By2

assignTimes

public final void assignTimes(AbstractComplex2By2 m,
                              double r)
assigns this with product of m and r

Overrides:
assignTimes in class AbstractComplex2By2

times

public final Complex2By2 times(double r)
returns the product of this and r


assignTimes

public final void assignTimes(double x,
                              double y)
assigns this with the product of itself and x+iy

Overrides:
assignTimes in class AbstractComplex2By2

assignTimes

public final void assignTimes(AbstractComplex2By2 m,
                              double x,
                              double y)
assigns this with the product of m and x+iy

Overrides:
assignTimes in class AbstractComplex2By2

times

public final Complex2By2 times(double x,
                               double y)
returns product of this and x+iy


assignTimes

public final void assignTimes(Complex z)
returns the product of this and z

Overrides:
assignTimes in class AbstractComplex2By2

assignTimes

public final void assignTimes(AbstractComplex2By2 m,
                              Complex z)
assigns this with product of m and z

Overrides:
assignTimes in class AbstractComplex2By2

times

public final Complex2By2 times(Complex z)
returns the product of this and z


assignDivide

public final void assignDivide(AbstractComplex2By2 m)
assigns this with the product of itself and inverse of m

Overrides:
assignDivide in class AbstractComplex2By2

assignDivide

public final void assignDivide(AbstractComplex2By2 a,
                               AbstractComplex2By2 b)
assigns this with the product of a and inverse of b

Overrides:
assignDivide in class AbstractComplex2By2

divide

public final Complex2By2 divide(AbstractComplex2By2 a)
returns the product of this and inverse of a


assignDivide

public final void assignDivide(double r)
assigns this with product of itself and 1/r

Overrides:
assignDivide in class AbstractComplex2By2

assignDivide

public final void assignDivide(AbstractComplex2By2 m,
                               double r)
assigns this with product of m and 1/r

Overrides:
assignDivide in class AbstractComplex2By2

divide

public final Complex2By2 divide(double r)
returns the product of this and 1/r


assignDivide

public final void assignDivide(double x,
                               double y)
assigns this with the product of itself and 1/(x+iy)

Overrides:
assignDivide in class AbstractComplex2By2

assignDivide

public final void assignDivide(AbstractComplex2By2 m,
                               double x,
                               double y)
assigns this with the product of m and 1/(x+iy)

Overrides:
assignDivide in class AbstractComplex2By2

divide

public final Complex2By2 divide(double x,
                                double y)
returns the product of this and 1/(x+iy)


assignDivide

public final void assignDivide(Complex z)
assigns this with the product of itself and 1/z

Overrides:
assignDivide in class AbstractComplex2By2

assignDivide

public final void assignDivide(AbstractComplex2By2 m,
                               Complex z)
assigns this with the product of m and 1/z

Overrides:
assignDivide in class AbstractComplex2By2

divide

public final Complex2By2 divide(Complex z)
returns the product of this and 1/z


plus

public final Complex2By2 plus(AbstractComplex2By2 a)
returns this with the sum of this and a


assignPlus

public final void assignPlus(AbstractComplex2By2 a)
assigns this with the sum of itself and a

Overrides:
assignPlus in class AbstractComplex2By2

assignPlus

public final void assignPlus(AbstractComplex2By2 a,
                             AbstractComplex2By2 b)
assigns this with the sum of a and b

Overrides:
assignPlus in class AbstractComplex2By2

plus

public final Complex2By2 plus(double x)
adds x to all entries of this and returns the result


assignPlus

public final void assignPlus(double x)
adds x to all entries of this

Overrides:
assignPlus in class AbstractComplex2By2

assignPlus

public final void assignPlus(AbstractComplex2By2 m,
                             double x)
adds x to all entries of m and and assigns this with the result.

Overrides:
assignPlus in class AbstractComplex2By2

plus

public final Complex2By2 plus(double x,
                              double y)
adds x+iy to all entries of this and returns the result


assignPlus

public final void assignPlus(double x,
                             double y)
adds x+iy to all entries of this

Overrides:
assignPlus in class AbstractComplex2By2

assignPlus

public final void assignPlus(AbstractComplex2By2 m,
                             double x,
                             double y)
adds x+iy to all entries of m and and assigns this with the result.

Overrides:
assignPlus in class AbstractComplex2By2

plus

public final Complex2By2 plus(Complex z)
adds z to all entries of this and returns the result


assignPlus

public final void assignPlus(Complex z)
adds z to all entries of this

Overrides:
assignPlus in class AbstractComplex2By2

assignPlus

public final void assignPlus(AbstractComplex2By2 m,
                             Complex z)
adds z to all entries of m and and assigns this with the result.

Overrides:
assignPlus in class AbstractComplex2By2

minus

public final Complex2By2 minus(AbstractComplex2By2 a)
subtracts a from this and returns the result


assignMinus

public final void assignMinus(AbstractComplex2By2 a)
subtracts a from this

Overrides:
assignMinus in class AbstractComplex2By2

assignMinus

public final void assignMinus(AbstractComplex2By2 a,
                              AbstractComplex2By2 b)
subtracts b from a and stores the result it this

Overrides:
assignMinus in class AbstractComplex2By2

minus

public final Complex2By2 minus(double x)
subtracts x from all entries of this and returns the result


assignMinus

public final void assignMinus(double x)
subtracts x from all entries of this

Overrides:
assignMinus in class AbstractComplex2By2

assignMinus

public final void assignMinus(AbstractComplex2By2 m,
                              double x)
subtracts x from all entries of m and and assigns this with the result.

Overrides:
assignMinus in class AbstractComplex2By2

minus

public final Complex2By2 minus(double x,
                               double y)
subtracts x+iy from all entries of this and returns the result


assignMinus

public final void assignMinus(double x,
                              double y)
subtracts x+iy to all entries of this

Overrides:
assignMinus in class AbstractComplex2By2

assignMinus

public final void assignMinus(AbstractComplex2By2 m,
                              double x,
                              double y)
subtracts x+iy to all entries of m and and assigns this with the result.

Overrides:
assignMinus in class AbstractComplex2By2

minus

public final Complex2By2 minus(Complex z)
subtracts z from all entries of this and returns the result


assignMinus

public final void assignMinus(Complex z)
subtracts z from all entries of this

Overrides:
assignMinus in class AbstractComplex2By2

assignMinus

public final void assignMinus(AbstractComplex2By2 m,
                              Complex z)
subtracts z to all entries of m and and assigns this with the result.

Overrides:
assignMinus in class AbstractComplex2By2

neg

public final Complex2By2 neg()
returns negative of this


assignNeg

public final void assignNeg(AbstractComplex2By2 a)
assigns this with the negative of a

Overrides:
assignNeg in class AbstractComplex2By2

assignNeg

public final void assignNeg()
assigns this with its own negative

Overrides:
assignNeg in class AbstractComplex2By2

conjugate

public final Complex2By2 conjugate()
returns conjugate of this


assignConjugate

public final void assignConjugate(AbstractComplex2By2 a)
assigns this with the conjugateative of a

Overrides:
assignConjugate in class AbstractComplex2By2

assignConjugate

public final void assignConjugate()
assigns this with its own conjugate

Overrides:
assignConjugate in class AbstractComplex2By2

transpose

public final Complex2By2 transpose()
returns transposed of this


assignTranspose

public final void assignTranspose(AbstractComplex2By2 a)
assigns this with the transposed of a

Overrides:
assignTranspose in class AbstractComplex2By2

assignTranspose

public final void assignTranspose()
assigns this with its own transposed

Overrides:
assignTranspose in class AbstractComplex2By2

star

public final Complex2By2 star()
returns transposed and conjugated of this


assignStar

public final void assignStar(AbstractComplex2By2 a)
assigns this with the transposed and conjugated of a

Overrides:
assignStar in class AbstractComplex2By2

assignStar

public final void assignStar()
assigns this with its own transposed and conjugated

Overrides:
assignStar in class AbstractComplex2By2

assignAdjugate

public final void assignAdjugate(AbstractComplex2By2 a)
assigns this with the adjugate of a

Overrides:
assignAdjugate in class AbstractComplex2By2

assignAdjugate

public final void assignAdjugate()
assigns this with its own adjugate

Overrides:
assignAdjugate in class AbstractComplex2By2

adjugate

public final Complex2By2 adjugate()
returns the adjugate of this


assignAdjoined

public final void assignAdjoined(AbstractComplex2By2 a)
assigns this with the adjoined of a

Overrides:
assignAdjoined in class AbstractComplex2By2

assignAdjoined

public final void assignAdjoined()
assigns this with its own adjoined

Overrides:
assignAdjoined in class AbstractComplex2By2

adjoined

public final Complex2By2 adjoined()
returns the adjoined of this


assignAdjoinedWith

public void assignAdjoinedWith(AbstractComplex2By2 t)
Assign this with t this t*.

Overrides:
assignAdjoinedWith in class AbstractComplex2By2
Parameters:
t - an AbstractComplex2By2: the matrix to adjoin

assignInvert

public final void assignInvert(AbstractComplex2By2 m)
assigns this with the inverse of m

Overrides:
assignInvert in class AbstractComplex2By2

assignInvert

public final void assignInvert()
assigns this with its own inverse

Overrides:
assignInvert in class AbstractComplex2By2

invert

public final Complex2By2 invert()
returns inverse of this


normalizeDeterminant

public final Complex2By2 normalizeDeterminant()
returns a normalized (determiant equals 1) copy of this


assignNormalizeDeterminant

public final void assignNormalizeDeterminant(AbstractComplex2By2 m)
assigns this with m and normalizes (determinant equals 1) it

Overrides:
assignNormalizeDeterminant in class AbstractComplex2By2

assignNormalizeDeterminant

public final void assignNormalizeDeterminant()
normalizes (determinant equals 1) this

Overrides:
assignNormalizeDeterminant in class AbstractComplex2By2

assignByColumn

public final void assignByColumn(Complex2 column1,
                                 Complex2 column2)

Assign this by column.

Simply calls AbstractComplex2By2.assignByColumn(Complex2, Complex2).

Overrides:
assignByColumn in class AbstractComplex2By2
Parameters:
column1 - a Complex2: the first column. Must not be null
column2 - a Complex2: the second column. Must not be null

assignByEigenvectors

public final void assignByEigenvectors(double eigenvalue1Re,
                                       double eigenvalue1Im,
                                       Complex2 eigenvector1,
                                       double eigenvalue2Re,
                                       double eigenvalue2Im,
                                       Complex2 eigenvector2)

Assign this by prescribing eigenvectors and eigenvalues.

The given eigenvectors must be linearly independent.

Simply calls AbstractComplex2By2.assignByEigenvectors(double, double, Complex2, double, double, Complex2).

Overrides:
assignByEigenvectors in class AbstractComplex2By2
Parameters:
eigenvalue1Re - a double: real part of the first eigenvalue
eigenvalue1Im - a double: imaginary part of the first eigenvalue
eigenvector1 - a Complex2: first eigenvector
eigenvalue2Re - a double: real part of the second eigenvalue
eigenvalue2Im - a double: imaginary part of the second eigenvalue
eigenvector2 - a Complex2: second eigenvector

assignByEigenvectors

public final void assignByEigenvectors(Complex eigenvalue1,
                                       Complex2 eigenvector1,
                                       Complex eigenvalue2,
                                       Complex2 eigenvector2)

Assign this by prescribing eigenvectors and eigenvalues.

The given eigenvectors must be linearly independent.

Simply calls AbstractComplex2By2.assignByEigenvectors(Complex, Complex2, Complex, Complex2).

Overrides:
assignByEigenvectors in class AbstractComplex2By2
Parameters:
eigenvalue1 - a Complex: first eigenvalue
eigenvector1 - a Complex2: first eigenvector
eigenvalue2 - a Complex: second eigenvalue
eigenvector2 - a Complex2: second eigenvector

assignAsEigenvectorMatrixOf

public void assignAsEigenvectorMatrixOf(HermitianComplex2By2 m)