JSci.maths
Class ComplexSquareMatrix

java.lang.Object
  extended by JSci.maths.Matrix
      extended by JSci.maths.ComplexMatrix
          extended by JSci.maths.ComplexSquareMatrix
All Implemented Interfaces:
java.io.Serializable, Algebra.Member, BanachSpace.Member, CStarAlgebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
Direct Known Subclasses:
ComplexTridiagonalMatrix, GammaMatrix

public class ComplexSquareMatrix
extends ComplexMatrix
implements CStarAlgebra.Member

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

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

Field Summary
protected  ComplexSquareMatrix[] LU
           
protected  int[] LUpivot
           
 
Fields inherited from class JSci.maths.ComplexMatrix
ARRAY_2D, matrixIm, matrixRe
 
Fields inherited from class JSci.maths.Matrix
CLASS_SPECIFIC, numCols, numRows, storageFormat
 
Constructor Summary
  ComplexSquareMatrix(Complex[][] array)
          Constructs a matrix from an array.
  ComplexSquareMatrix(ComplexVector[] array)
          Constructs a matrix from an array of vectors.
  ComplexSquareMatrix(double[][] arrayRe, double[][] arrayIm)
          Constructs a matrix by wrapping two arrays.
  ComplexSquareMatrix(int size)
          Constructs an empty matrix.
protected ComplexSquareMatrix(int size, int storeID)
          Constructs a matrix.
 
Method Summary
 ComplexMatrix add(ComplexMatrix m)
          Returns the addition of this matrix and another.
 ComplexSquareMatrix add(ComplexSquareMatrix m)
          Returns the addition of this matrix and another.
 ComplexMatrix conjugate()
          Returns the complex conjugate of this matrix.
 Complex det()
          Returns the determinant.
 ComplexMatrix hermitianAdjoint()
          Returns the hermitian adjoint of this matrix.
 ComplexSquareMatrix inverse()
          Returns the inverse of this matrix.
 CStarAlgebra.Member involution()
          Returns the involution of this matrix.
 boolean isHermitian()
          Returns true if this matrix is hermitian.
 boolean isUnitary()
          Returns true if this matrix is unitary.
 ComplexSquareMatrix[] luDecompose(int[] pivot)
          Returns the LU decomposition of this matrix.
 ComplexMatrix mapElements(ComplexMapping f)
          Applies a function on all the matrix elements.
 ComplexSquareMatrix multiply(ComplexSquareMatrix m)
          Returns the multiplication of this matrix and another.
 ComplexVector multiply(ComplexVector v)
          Returns the multiplication of a vector by this matrix.
 double norm()
          Returns the C* norm.
 double operatorNorm()
          Returns the operator norm.
 ComplexSquareMatrix[] polarDecompose()
          Returns the polar decomposition of this matrix.
 ComplexMatrix scalarMultiply(Complex z)
          Returns the multiplication of this matrix by a scalar.
 ComplexMatrix scalarMultiply(double x)
          Returns the multiplication of this matrix by a scalar.
 ComplexMatrix subtract(ComplexMatrix m)
          Returns the subtraction of this matrix by another.
 ComplexSquareMatrix subtract(ComplexSquareMatrix m)
          Returns the subtraction of this matrix by another.
 Complex trace()
          Returns the trace.
 Matrix transpose()
          Returns the transpose of this matrix.
 
Methods inherited from class JSci.maths.ComplexMatrix
add, directSum, equals, finalize, frobeniusNorm, getElement, hashCode, imag, infNorm, multiply, multiply, negate, real, scalarDivide, scalarDivide, scalarDivide, scalarMultiply, setElement, setElement, subtract, tensorProduct, toString
 
Methods inherited from class JSci.maths.Matrix
columns, getInvalidElementMsg, rows
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface JSci.maths.fields.Ring.Member
multiply
 
Methods inherited from interface JSci.maths.algebras.VectorSpace.Member
scalarDivide
 
Methods inherited from interface JSci.maths.algebras.Module.Member
scalarMultiply
 

Field Detail

LU

protected transient ComplexSquareMatrix[] LU

LUpivot

protected transient int[] LUpivot
Constructor Detail

ComplexSquareMatrix

protected ComplexSquareMatrix(int size,
                              int storeID)
Constructs a matrix.


ComplexSquareMatrix

public ComplexSquareMatrix(int size)
Constructs an empty matrix.

Parameters:
size - the number of rows/columns

ComplexSquareMatrix

public ComplexSquareMatrix(double[][] arrayRe,
                           double[][] arrayIm)
Constructs a matrix by wrapping two arrays.

Parameters:
arrayRe - an array of real values
arrayIm - an array of imaginary values
Throws:
MatrixDimensionException - If the array is not square.

ComplexSquareMatrix

public ComplexSquareMatrix(Complex[][] array)
Constructs a matrix from an array.

Parameters:
array - an assigned value
Throws:
MatrixDimensionException - If the array is not square.

ComplexSquareMatrix

public ComplexSquareMatrix(ComplexVector[] array)
Constructs a matrix from an array of vectors. The vectors form columns in the matrix.

Parameters:
array - an assigned value.
Throws:
MatrixDimensionException - If the array is not square.
Method Detail

isHermitian

public boolean isHermitian()
Returns true if this matrix is hermitian.


isUnitary

public boolean isUnitary()
Returns true if this matrix is unitary.


det

public Complex det()
Returns the determinant.


trace

public Complex trace()
Returns the trace.


norm

public double norm()
Returns the C* norm.

Specified by:
norm in interface BanachSpace.Member

operatorNorm

public double operatorNorm()
                    throws MaximumIterationsExceededException
Returns the operator norm.

Throws:
MaximumIterationsExceededException - If it takes more than 50 iterations to determine an eigenvalue.

add

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

Overrides:
add in class ComplexMatrix
Parameters:
m - a complex matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

add

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

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

subtract

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

Overrides:
subtract in class ComplexMatrix
Parameters:
m - a complex matrix
Throws:
MatrixDimensionException - If the matrices are different sizes.

subtract

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

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

scalarMultiply

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

Overrides:
scalarMultiply in class ComplexMatrix
Parameters:
z - a complex number
Returns:
a complex square matrix

scalarMultiply

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

Overrides:
scalarMultiply in class ComplexMatrix
Parameters:
x - a double
Returns:
a complex square matrix

multiply

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

Overrides:
multiply in class ComplexMatrix
Parameters:
v - a complex vector
Throws:
DimensionException - If the matrix and vector are incompatible.

multiply

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

Parameters:
m - a complex square matrix
Throws:
MatrixDimensionException - If the matrices are incompatible.

involution

public CStarAlgebra.Member involution()
Returns the involution of this matrix.

Specified by:
involution in interface CStarAlgebra.Member

hermitianAdjoint

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

Overrides:
hermitianAdjoint in class ComplexMatrix
Returns:
a complex square matrix

conjugate

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

Overrides:
conjugate in class ComplexMatrix
Returns:
a complex square matrix

transpose

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

Overrides:
transpose in class ComplexMatrix
Returns:
a complex square matrix

inverse

public ComplexSquareMatrix inverse()
Returns the inverse of this matrix.

Returns:
a complex square matrix

luDecompose

public ComplexSquareMatrix[] luDecompose(int[] pivot)
Returns the LU decomposition of this matrix.

Returns:
an array with [0] containing the L-matrix and [1] containing the U-matrix.

polarDecompose

public ComplexSquareMatrix[] polarDecompose()
Returns the polar decomposition of this matrix.


mapElements

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

Overrides:
mapElements in class ComplexMatrix
Parameters:
f - a user-defined function
Returns:
a complex square matrix