JSci.maths.matrices
Class AbstractComplexMatrix

java.lang.Object
  extended by JSci.maths.matrices.Matrix
      extended by JSci.maths.matrices.AbstractComplexMatrix
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
Direct Known Subclasses:
AbstractComplexSquareMatrix, ComplexMatrix

public abstract class AbstractComplexMatrix
extends Matrix

The AbstractComplexMatrix class provides an object for encapsulating matrices containing complex numbers.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class JSci.maths.matrices.Matrix
numCols, numRows
 
Constructor Summary
protected AbstractComplexMatrix(int rows, int cols)
          Constructs a matrix.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member m)
          Returns the addition of this matrix and another.
 AbstractComplexMatrix add(AbstractComplexMatrix m)
          Returns the addition of this matrix and another.
 AbstractComplexMatrix conjugate()
          Returns the complex conjugate of this matrix.
 AbstractComplexMatrix directSum(AbstractComplexMatrix m)
          Returns the direct sum of this matrix and another.
 boolean equals(AbstractComplexMatrix m)
          Compares two complex matrices for equality.
 boolean equals(AbstractComplexMatrix m, double tol)
           
 boolean equals(java.lang.Object obj)
          Compares two complex matrices for equality.
 double frobeniusNorm()
          Returns the Frobenius or Hilbert-Schmidt (l2) norm.
abstract  Complex getElement(int i, int j)
          Returns an element of the matrix.
abstract  double getImagElement(int i, int j)
          Returns the imag part of an element of the matrix.
abstract  double getRealElement(int i, int j)
          Returns the real part of an element of the matrix.
 java.lang.Object getSet()
           
 int hashCode()
          Returns a hashcode for this matrix.
 AbstractComplexMatrix hermitianAdjoint()
          Returns the hermitian adjoint of this matrix.
 AbstractDoubleMatrix imag()
          Returns the imaginary part of this complex matrix.
 double infNorm()
          Returns the linfinity-norm.
 AbstractComplexMatrix mapElements(ComplexMapping f)
          Applies a function on all the matrix elements.
 AbstractComplexMatrix multiply(AbstractComplexMatrix m)
          Returns the multiplication of this matrix and another.
 AbstractComplexVector multiply(AbstractComplexVector v)
          Returns the multiplication of a vector by this matrix.
 Ring.Member multiply(Ring.Member m)
          Returns the multiplication of this matrix and another.
 AbelianGroup.Member negate()
          Returns the negative of this matrix.
 AbstractDoubleMatrix real()
          Returns the real part of this complex matrix.
 AbstractComplexMatrix scalarDivide(Complex z)
          Returns the division of this matrix by a scalar.
 AbstractComplexMatrix scalarDivide(double x)
          Returns the division of this matrix by a scalar.
 VectorSpace.Member scalarDivide(Field.Member x)
          Returns the division of this matrix by a scalar.
 AbstractComplexMatrix scalarMultiply(Complex z)
          Returns the multiplication of this matrix by a scalar.
 AbstractComplexMatrix scalarMultiply(double x)
          Returns the multiplication of this matrix by a scalar.
 Module.Member scalarMultiply(Ring.Member x)
          Returns the multiplication of this matrix by a scalar.
 Complex scalarProduct(AbstractComplexMatrix m)
          Returns the scalar product of this matrix and another.
abstract  void setElement(int i, int j, Complex z)
          Sets the value of an element of the matrix.
abstract  void setElement(int i, int j, double x, double y)
          Sets the value of an element of the matrix.
 AbelianGroup.Member subtract(AbelianGroup.Member m)
          Returns the subtraction of this matrix by another.
 AbstractComplexMatrix subtract(AbstractComplexMatrix m)
          Returns the subtraction of this matrix by another.
 AbstractComplexMatrix tensor(AbstractComplexMatrix m)
          Returns the tensor product of this matrix and another.
 java.lang.String toString()
          Returns a string representing this matrix.
 Matrix transpose()
          Returns the transpose of this matrix.
 
Methods inherited from class JSci.maths.matrices.Matrix
columns, getInvalidElementMsg, rows
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractComplexMatrix

protected AbstractComplexMatrix(int rows,
                                int cols)
Constructs a matrix.

Method Detail

equals

public final boolean equals(java.lang.Object obj)
Compares two complex matrices for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a complex matrix

equals

public final boolean equals(AbstractComplexMatrix m)
Compares two complex matrices for equality. Two matrices are considered to be equal if the Frobenius norm of their difference is within the zero tolerance.

Parameters:
m - a complex matrix

equals

public boolean equals(AbstractComplexMatrix m,
                      double tol)

toString

public java.lang.String toString()
Returns a string representing this matrix.

Overrides:
toString in class java.lang.Object

hashCode

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

Overrides:
hashCode in class java.lang.Object

real

public AbstractDoubleMatrix real()
Returns the real part of this complex matrix.

Returns:
a double matrix

imag

public AbstractDoubleMatrix imag()
Returns the imaginary part of this complex matrix.

Returns:
a double matrix

getElement

public abstract Complex getElement(int i,
                                   int j)
Returns an element of the matrix.

Parameters:
i - row index of the element
j - column index of the element
Throws:
MatrixDimensionException - If attempting to access an invalid element.

getRealElement

public abstract double getRealElement(int i,
                                      int j)
Returns the real part of an element of the matrix.

Parameters:
i - row index of the element
j - column index of the element
Throws:
MatrixDimensionException - If attempting to access an invalid element.

getImagElement

public abstract double getImagElement(int i,
                                      int j)
Returns the imag part of an element of the matrix.

Parameters:
i - row index of the element
j - column index of the element
Throws:
MatrixDimensionException - If attempting to access an invalid element.

setElement

public abstract void setElement(int i,
                                int j,
                                Complex z)
Sets the value of an element of the matrix. Should only be used to initialise this matrix.

Parameters:
i - row index of the element
j - column index of the element
z - a complex number
Throws:
MatrixDimensionException - If attempting to access an invalid element.

setElement

public abstract void setElement(int i,
                                int j,
                                double x,
                                double y)
Sets the value of an element of the matrix. Should only be used to initialise this matrix.

Parameters:
i - row index of the element
j - column index of the element
x - the real part of a complex number
y - the imaginary part of a complex number
Throws:
MatrixDimensionException - If attempting to access an invalid element.

getSet

public java.lang.Object getSet()

infNorm

public double infNorm()
Returns the linfinity-norm.


frobeniusNorm

public double frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm.

PlanetMath references:
FrobeniusMatrixNorm

negate

public AbelianGroup.Member negate()
Returns the negative of this matrix.


add

public final AbelianGroup.Member add(AbelianGroup.Member m)
Returns the addition of this matrix and another.

Parameters:
m - a group member

add

public AbstractComplexMatrix add(AbstractComplexMatrix m)
Returns the addition of this matrix and another.

Parameters:
m - a complex matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

subtract

public final AbelianGroup.Member subtract(AbelianGroup.Member m)
Returns the subtraction of this matrix by another.

Parameters:
m - a group member

subtract

public AbstractComplexMatrix subtract(AbstractComplexMatrix m)
Returns the subtraction of this matrix by another.

Parameters:
m - a complex matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

scalarMultiply

public final Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this matrix by a scalar.

Parameters:
x - a ring member

scalarMultiply

public AbstractComplexMatrix scalarMultiply(Complex z)
Returns the multiplication of this matrix by a scalar.

Parameters:
z - a complex number
Returns:
a complex matrix

scalarMultiply

public AbstractComplexMatrix scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar.

Parameters:
x - a double
Returns:
a complex matrix

scalarDivide

public final VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this matrix by a scalar.

Parameters:
x - a field member

scalarDivide

public AbstractComplexMatrix scalarDivide(Complex z)
Returns the division of this matrix by a scalar.

Parameters:
z - a complex number
Returns:
a complex matrix

scalarDivide

public AbstractComplexMatrix scalarDivide(double x)
Returns the division of this matrix by a scalar.

Parameters:
x - a double
Returns:
a complex matrix

scalarProduct

public Complex scalarProduct(AbstractComplexMatrix m)
Returns the scalar product of this matrix and another.

Parameters:
m - a complex matrix.
Throws:
MatrixDimensionException - If the matrices are different sizes.

multiply

public AbstractComplexVector multiply(AbstractComplexVector v)
Returns the multiplication of a vector by this matrix.

Parameters:
v - a complex vector
Throws:
DimensionException - If the matrix and vector are incompatible.

multiply

public final Ring.Member multiply(Ring.Member m)
Returns the multiplication of this matrix and another.

Parameters:
m - a ring member

multiply

public AbstractComplexMatrix multiply(AbstractComplexMatrix m)
Returns the multiplication of this matrix and another.

Parameters:
m - a complex matrix
Returns:
an AbstractComplexMatrix or an AbstractComplexSquareMatrix as appropriate
Throws:
MatrixDimensionException - If the matrices are incompatible.

directSum

public AbstractComplexMatrix directSum(AbstractComplexMatrix m)
Returns the direct sum of this matrix and another.


tensor

public AbstractComplexMatrix tensor(AbstractComplexMatrix m)
Returns the tensor product of this matrix and another.


hermitianAdjoint

public AbstractComplexMatrix hermitianAdjoint()
Returns the hermitian adjoint of this matrix.

Returns:
a complex matrix

conjugate

public AbstractComplexMatrix conjugate()
Returns the complex conjugate of this matrix.

Returns:
a complex matrix

transpose

public Matrix transpose()
Returns the transpose of this matrix.

Specified by:
transpose in class Matrix
Returns:
a complex matrix

mapElements

public AbstractComplexMatrix mapElements(ComplexMapping f)
Applies a function on all the matrix elements.

Parameters:
f - a user-defined function
Returns:
a complex matrix