|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jscience.mathematics.algebraic.AbstractHypermatrix
org.jscience.mathematics.algebraic.AbstractMatrix
org.jscience.mathematics.algebraic.matrices.AbstractComplexMatrix
org.jscience.mathematics.algebraic.matrices.ComplexMatrix
public class ComplexMatrix
The ComplexMatrix class provides an object for encapsulating matrices containing complex numbers.
Field Summary | |
---|---|
protected double[][] |
matrixIm
Arrays containing the elements of the matrix. |
protected double[][] |
matrixRe
Arrays containing the elements of the matrix. |
Constructor Summary | |
---|---|
ComplexMatrix(Complex[][] array)
Constructs a matrix from an array. |
|
ComplexMatrix(ComplexMatrix mat)
Copy constructor. |
|
ComplexMatrix(ComplexVector[] array)
Constructs a matrix from an array of vectors (columns). |
|
ComplexMatrix(double[][] arrayRe,
double[][] arrayIm)
Constructs a matrix by wrapping two arrays. |
|
ComplexMatrix(int rows,
int cols)
Constructs an empty matrix. |
Method Summary | |
---|---|
AbstractComplexMatrix |
add(AbstractComplexMatrix m)
Returns the addition of this matrix and another. |
ComplexMatrix |
add(ComplexMatrix m)
|
java.lang.Object |
clone()
Clone matrix into a new matrix. |
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,
double tol)
Compares two complex matrices for equality. |
double |
frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm. |
AbstractComplexVector |
getColumn(int j)
Returns the ith column. |
double |
getImagElement(int i,
int j)
Returns the imag part of an element of the matrix. |
Complex |
getPrimitiveElement(int i,
int j)
Returns an element of the matrix. |
double |
getRealElement(int i,
int j)
Returns the real part of an element of the matrix. |
AbstractComplexVector |
getRow(int i)
Returns the ith row. |
AbstractComplexMatrix |
hermitianAdjoint()
Returns the hermitian adjoint of this matrix. |
AbstractDoubleMatrix |
imag()
Returns the imaginary part of this complex matrix. |
double |
infNorm()
Returns the l ![]() |
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. |
AbstractComplexMatrix |
multiply(ComplexMatrix m)
|
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. |
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. |
void |
setAllElements(Complex m)
Sets the value of all elements of the matrix. |
void |
setElement(int i,
int j,
Complex z)
Sets the value of an element of the matrix. |
void |
setElement(int i,
int j,
double x,
double y)
Sets the value of an element of the matrix. |
AbstractComplexMatrix |
subtract(AbstractComplexMatrix m)
Returns the subtraction of this matrix by another. |
ComplexMatrix |
subtract(ComplexMatrix m)
|
AbstractComplexMatrix |
tensorProduct(AbstractComplexMatrix m)
Returns the tensor product of this matrix and another. |
Complex[][] |
toPrimitiveArray()
Projects the matrix to an array. |
java.lang.String |
toString()
Returns a string representing this matrix. |
Matrix |
transpose()
Returns the transpose of this matrix. |
Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractComplexMatrix |
---|
abs, add, equals, equals, getElement, getMatrixAsColumns, getMatrixAsRows, getSet, getSubMatrix, hashCode, horizontalAxisSymmetry, mass, multiply, read, reverse, scalarDivide, scalarMultiply, scalarProduct, setColumn, setRow, setSubMatrix, subtract, verticalAxisSymmetry |
Methods inherited from class org.jscience.mathematics.algebraic.AbstractMatrix |
---|
getElement, getInvalidElementMsg, numColumns, numRows, print, print, print, print, toArray, toArray |
Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix |
---|
getDimensions, numDimensions, numElements, numElements, toArray |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jscience.mathematics.algebraic.Hypermatrix |
---|
getDimensions, numDimensions, numElements, numElements, toArray |
Field Detail |
---|
protected double[][] matrixRe
protected double[][] matrixIm
Constructor Detail |
---|
public ComplexMatrix(int rows, int cols)
rows
- the number of rowscols
- the number of columnspublic ComplexMatrix(double[][] arrayRe, double[][] arrayIm)
arrayRe
- an array of real valuesarrayIm
- an array of imaginary valuespublic ComplexMatrix(Complex[][] array)
array
- an assigned valuepublic ComplexMatrix(ComplexVector[] array)
array
- an assigned valuepublic ComplexMatrix(ComplexMatrix mat)
mat
- an assigned valueMethod Detail |
---|
public boolean equals(AbstractComplexMatrix m, double tol)
equals
in class AbstractComplexMatrix
m
- a complex matrixpublic java.lang.String toString()
toString
in class AbstractComplexMatrix
public AbstractDoubleMatrix real()
real
in class AbstractComplexMatrix
public AbstractDoubleMatrix imag()
imag
in class AbstractComplexMatrix
public Complex getPrimitiveElement(int i, int j)
getPrimitiveElement
in class AbstractComplexMatrix
i
- row index of the elementj
- column index of the element
IllegalDimensionException
- If attempting to access an invalid element.public double getRealElement(int i, int j)
AbstractComplexMatrix
getRealElement
in class AbstractComplexMatrix
i
- row index of the elementj
- column index of the elementpublic double getImagElement(int i, int j)
AbstractComplexMatrix
getImagElement
in class AbstractComplexMatrix
i
- row index of the elementj
- column index of the elementpublic AbstractComplexVector getRow(int i)
getRow
in interface Matrix
getRow
in class AbstractComplexMatrix
i
- DOCUMENT ME!
public AbstractComplexVector getColumn(int j)
getColumn
in interface Matrix
getColumn
in class AbstractComplexMatrix
j
- DOCUMENT ME!
public void setElement(int i, int j, Complex z)
setElement
in class AbstractComplexMatrix
i
- row index of the elementj
- column index of the elementz
- a complex number
IllegalDimensionException
- If attempting to access an invalid element.public void setElement(int i, int j, double x, double y)
setElement
in class AbstractComplexMatrix
i
- row index of the elementj
- column index of the elementx
- the real part of a complex numbery
- the imaginary part of a complex number
IllegalDimensionException
- If attempting to access an invalid element.public void setAllElements(Complex m)
setAllElements
in class AbstractComplexMatrix
m
- a complex elementpublic double infNorm()
infNorm
in class AbstractComplexMatrix
public double frobeniusNorm()
frobeniusNorm
in class AbstractComplexMatrix
public AbelianGroup.Member negate()
negate
in interface AbelianGroup.Member
negate
in class AbstractComplexMatrix
public AbstractComplexMatrix add(AbstractComplexMatrix m)
add
in class AbstractComplexMatrix
m
- a complex matrix
IllegalDimensionException
- If the matrices are different sizes.public ComplexMatrix add(ComplexMatrix m)
public AbstractComplexMatrix subtract(AbstractComplexMatrix m)
subtract
in class AbstractComplexMatrix
m
- a complex matrix
IllegalDimensionException
- If the matrices are different sizes.public ComplexMatrix subtract(ComplexMatrix m)
public AbstractComplexMatrix scalarMultiply(Complex z)
scalarMultiply
in class AbstractComplexMatrix
z
- a complex number
public AbstractComplexMatrix scalarMultiply(double x)
scalarMultiply
in class AbstractComplexMatrix
x
- a double
public AbstractComplexMatrix scalarDivide(Complex z)
scalarDivide
in class AbstractComplexMatrix
z
- a complex number
public AbstractComplexMatrix scalarDivide(double x)
scalarDivide
in class AbstractComplexMatrix
x
- a double
public AbstractComplexVector multiply(AbstractComplexVector v)
multiply
in class AbstractComplexMatrix
v
- a complex vector
IllegalDimensionException
- If the matrix and vector are incompatible.public AbstractComplexMatrix multiply(AbstractComplexMatrix m)
multiply
in class AbstractComplexMatrix
m
- a complex matrix
IllegalDimensionException
- If the matrices are incompatible.public AbstractComplexMatrix multiply(ComplexMatrix m)
public AbstractComplexMatrix directSum(AbstractComplexMatrix m)
directSum
in class AbstractComplexMatrix
public AbstractComplexMatrix tensorProduct(AbstractComplexMatrix m)
tensorProduct
in class AbstractComplexMatrix
public AbstractComplexMatrix hermitianAdjoint()
hermitianAdjoint
in class AbstractComplexMatrix
public AbstractComplexMatrix conjugate()
conjugate
in class AbstractComplexMatrix
public Matrix transpose()
transpose
in interface Matrix
transpose
in class AbstractComplexMatrix
public AbstractComplexMatrix mapElements(ComplexMapping f)
mapElements
in class AbstractComplexMatrix
f
- a user-defined function
public java.lang.Object clone()
clone
in class java.lang.Object
public Complex[][] toPrimitiveArray()
toPrimitiveArray
in class AbstractComplexMatrix
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |