JScience v4.3

org.jscience.mathematics.vector
Class ComplexMatrix

java.lang.Object
  extended by org.jscience.mathematics.vector.Matrix<Complex>
      extended by org.jscience.mathematics.vector.ComplexMatrix
All Implemented Interfaces:
javolution.lang.Immutable, javolution.lang.Realtime, javolution.lang.ValueType, GroupAdditive<Matrix<Complex>>, Ring<Matrix<Complex>>, Structure<Matrix<Complex>>, VectorSpace<Matrix<Complex>,Complex>

public final class ComplexMatrix
extends Matrix<Complex>

This class represents an optimized matrix implementation for complex numbers.

Instances of this class can be created from ComplexVector, either as rows or columns if the matrix is transposed. For example:

        ComplexVector<Rational> column0 = ComplexVector.valueOf(...);
        ComplexVector<Rational> column1 = ComplexVector.valueOf(...);
        ComplexMatrix<Rational> M = ComplexMatrix.valueOf(column0, column1).transpose();
     

Version:
3.3, January 2, 2007
Author:
Jean-Marie Dautelle

Field Summary
 
Fields inherited from class org.jscience.mathematics.vector.Matrix
XML
 
Method Summary
 ComplexMatrix adjoint()
          Returns the adjoint of this matrix.
 Complex cofactor(int i, int j)
          Returns the cofactor of an element in this matrix.
 ComplexMatrix copy()
          Returns a copy of this matrix allocated by the calling thread (possibly on the stack).
 Complex determinant()
          Returns the determinant of this matrix.
 Complex get(int i, int j)
          Returns a single element from this matrix.
 ComplexVector getColumn(int j)
          Returns the column identified by the specified index in this matrix.
 ComplexVector getDiagonal()
          Returns the diagonal vector.
 int getNumberOfColumns()
          Returns the number of columns n for this matrix.
 int getNumberOfRows()
          Returns the number of rows m for this matrix.
 ComplexVector getRow(int i)
          Returns the row identified by the specified index in this matrix.
 ComplexMatrix inverse()
          Returns the inverse of this matrix (must be square).
 ComplexMatrix minus(Matrix<Complex> that)
          Returns the difference between this matrix and the one specified.
 ComplexMatrix opposite()
          Returns the negation of this matrix.
 ComplexMatrix plus(Matrix<Complex> that)
          Returns the sum of this matrix with the one specified.
 ComplexMatrix tensor(Matrix<Complex> that)
          Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product).
 ComplexMatrix times(Complex k)
          Returns the product of this matrix by the specified factor.
 ComplexMatrix times(Matrix<Complex> that)
          Returns the product of this matrix with the one specified.
 ComplexVector times(Vector<Complex> v)
          Returns the product of this matrix by the specified vector.
 ComplexMatrix transpose()
          Returns the transpose of this matrix.
static ComplexMatrix valueOf(Complex[][] elements)
          Returns a complex matrix from the specified 2-dimensional array.
static ComplexMatrix valueOf(ComplexVector... rows)
          Returns a complex matrix holding the specified row vectors (column vectors if transposed).
static ComplexMatrix valueOf(java.util.List<ComplexVector> rows)
          Returns a complex matrix holding the row vectors from the specified collection (column vectors if transposed).
static ComplexMatrix valueOf(Matrix<Complex> that)
          Returns a complex matrix equivalent to the specified matrix.
 ComplexVector vectorization()
          Returns the vectorization of this matrix.
 
Methods inherited from class org.jscience.mathematics.vector.Matrix
divide, equals, equals, hashCode, isSquare, pow, pseudoInverse, solve, solve, toString, toText, trace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

valueOf

public static ComplexMatrix valueOf(Complex[][] elements)
Returns a complex matrix from the specified 2-dimensional array. The first dimension being the row and the second being the column.

Parameters:
elements - this matrix elements.
Returns:
the matrix having the specified elements.
Throws:
DimensionException - if rows have different length.
See Also:
ComplexVector

valueOf

public static ComplexMatrix valueOf(ComplexVector... rows)
Returns a complex matrix holding the specified row vectors (column vectors if transposed).

Parameters:
rows - the row vectors.
Returns:
the matrix having the specified rows.
Throws:
DimensionException - if the rows do not have the same dimension.

valueOf

public static ComplexMatrix valueOf(java.util.List<ComplexVector> rows)
Returns a complex matrix holding the row vectors from the specified collection (column vectors if transposed).

Parameters:
rows - the list of row vectors.
Returns:
the matrix having the specified rows.
Throws:
DimensionException - if the rows do not have the same dimension.

valueOf

public static ComplexMatrix valueOf(Matrix<Complex> that)
Returns a complex matrix equivalent to the specified matrix.

Parameters:
that - the matrix to convert.
Returns:
that or a complex matrix holding the same elements as the specified matrix.

getNumberOfRows

public int getNumberOfRows()
Description copied from class: Matrix
Returns the number of rows m for this matrix.

Specified by:
getNumberOfRows in class Matrix<Complex>
Returns:
m, the number of rows.

getNumberOfColumns

public int getNumberOfColumns()
Description copied from class: Matrix
Returns the number of columns n for this matrix.

Specified by:
getNumberOfColumns in class Matrix<Complex>
Returns:
n, the number of columns.

get

public Complex get(int i,
                   int j)
Description copied from class: Matrix
Returns a single element from this matrix.

Specified by:
get in class Matrix<Complex>
Parameters:
i - the row index (range [0..m[).
j - the column index (range [0..n[).
Returns:
the element read at [i,j].

getRow

public ComplexVector getRow(int i)
Description copied from class: Matrix
Returns the row identified by the specified index in this matrix.

Specified by:
getRow in class Matrix<Complex>
Parameters:
i - the row index (range [0..m[).
Returns:
the vector holding the specified row.

getColumn

public ComplexVector getColumn(int j)
Description copied from class: Matrix
Returns the column identified by the specified index in this matrix.

Specified by:
getColumn in class Matrix<Complex>
Parameters:
j - the column index (range [0..n[).
Returns:
the vector holding the specified column.

getDiagonal

public ComplexVector getDiagonal()
Description copied from class: Matrix
Returns the diagonal vector.

Specified by:
getDiagonal in class Matrix<Complex>
Returns:
the vector holding the diagonal elements.

opposite

public ComplexMatrix opposite()
Description copied from class: Matrix
Returns the negation of this matrix.

Specified by:
opposite in interface GroupAdditive<Matrix<Complex>>
Specified by:
opposite in class Matrix<Complex>
Returns:
-this.

plus

public ComplexMatrix plus(Matrix<Complex> that)
Description copied from class: Matrix
Returns the sum of this matrix with the one specified.

Specified by:
plus in interface GroupAdditive<Matrix<Complex>>
Specified by:
plus in class Matrix<Complex>
Parameters:
that - the matrix to be added.
Returns:
this + that.

minus

public ComplexMatrix minus(Matrix<Complex> that)
Description copied from class: Matrix
Returns the difference between this matrix and the one specified.

Overrides:
minus in class Matrix<Complex>
Parameters:
that - the matrix to be subtracted.
Returns:
this - that.

times

public ComplexMatrix times(Complex k)
Description copied from class: Matrix
Returns the product of this matrix by the specified factor.

Specified by:
times in interface VectorSpace<Matrix<Complex>,Complex>
Specified by:
times in class Matrix<Complex>
Parameters:
k - the coefficient multiplier.
Returns:
this · k

times

public ComplexVector times(Vector<Complex> v)
Description copied from class: Matrix
Returns the product of this matrix by the specified vector.

Specified by:
times in class Matrix<Complex>
Parameters:
v - the vector.
Returns:
this · v

times

public ComplexMatrix times(Matrix<Complex> that)
Description copied from class: Matrix
Returns the product of this matrix with the one specified.

Specified by:
times in interface Ring<Matrix<Complex>>
Specified by:
times in class Matrix<Complex>
Parameters:
that - the matrix multiplier.
Returns:
this · that.

inverse

public ComplexMatrix inverse()
Description copied from class: Matrix
Returns the inverse of this matrix (must be square).

Specified by:
inverse in class Matrix<Complex>
Returns:
1 / this

determinant

public Complex determinant()
Description copied from class: Matrix
Returns the determinant of this matrix.

Specified by:
determinant in class Matrix<Complex>
Returns:
this matrix determinant.

transpose

public ComplexMatrix transpose()
Description copied from class: Matrix
Returns the transpose of this matrix.

Specified by:
transpose in class Matrix<Complex>
Returns:
A'.

cofactor

public Complex cofactor(int i,
                        int j)
Description copied from class: Matrix
Returns the cofactor of an element in this matrix. It is the value obtained by evaluating the determinant formed by the elements not in that particular row or column.

Specified by:
cofactor in class Matrix<Complex>
Parameters:
i - the row index.
j - the column index.
Returns:
the cofactor of THIS[i,j].

adjoint

public ComplexMatrix adjoint()
Description copied from class: Matrix
Returns the adjoint of this matrix. It is obtained by replacing each element in this matrix with its cofactor and applying a + or - sign according (-1)**(i+j), and then finding the transpose of the resulting matrix.

Specified by:
adjoint in class Matrix<Complex>
Returns:
the adjoint of this matrix.

tensor

public ComplexMatrix tensor(Matrix<Complex> that)
Description copied from class: Matrix
Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product). The default implementation returns a DenseMatrix.

Specified by:
tensor in class Matrix<Complex>
Parameters:
that - the second matrix.
Returns:
this ⊗ that
See Also:
Wikipedia: Kronecker Product

vectorization

public ComplexVector vectorization()
Description copied from class: Matrix
Returns the vectorization of this matrix. The vectorization of a matrix is the column vector obtain by stacking the columns of the matrix on top of one another. The default implementation returns a DenseVector.

Specified by:
vectorization in class Matrix<Complex>
Returns:
the vectorization of this matrix.
See Also:
Wikipedia: Vectorization.

copy

public ComplexMatrix copy()
Description copied from class: Matrix
Returns a copy of this matrix allocated by the calling thread (possibly on the stack).

Specified by:
copy in interface javolution.lang.ValueType
Specified by:
copy in class Matrix<Complex>
Returns:
an identical and independant copy of this matrix.

JScience v4.3

Copyright © 2006 JScience.