Package org.jscience.mathematics.vector
Class ComplexMatrix
- java.lang.Object
-
- org.jscience.mathematics.vector.Matrix<Complex>
-
- 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
matriximplementation forcomplexnumbers.Instances of this class can be created from
ComplexVector, either as rows or columns if the matrix is transposed. For example:[code] ComplexVectorcolumn0 = ComplexVector.valueOf(...); ComplexVector column1 = ComplexVector.valueOf(...); ComplexMatrix M = ComplexMatrix.valueOf(column0, column1).transpose(); [/code] - Version:
- 3.3, January 2, 2007
- Author:
- Jean-Marie Dautelle
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ComplexMatrixadjoint()Returns the adjoint of this matrix.Complexcofactor(int i, int j)Returns the cofactor of an element in this matrix.ComplexMatrixcopy()Returns a copy of this matrixallocatedby the calling thread (possibly on the stack).Complexdeterminant()Returns the determinant of this matrix.Complexget(int i, int j)Returns a single element from this matrix.ComplexVectorgetColumn(int j)Returns the column identified by the specified index in this matrix.ComplexVectorgetDiagonal()Returns the diagonal vector.intgetNumberOfColumns()Returns the number of columnsnfor this matrix.intgetNumberOfRows()Returns the number of rowsmfor this matrix.ComplexVectorgetRow(int i)Returns the row identified by the specified index in this matrix.ComplexMatrixinverse()Returns the inverse of this matrix (must be square).ComplexMatrixminus(Matrix<Complex> that)Returns the difference between this matrix and the one specified.ComplexMatrixopposite()Returns the negation of this matrix.ComplexMatrixplus(Matrix<Complex> that)Returns the sum of this matrix with the one specified.ComplexMatrixtensor(Matrix<Complex> that)Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product).ComplexMatrixtimes(Complex k)Returns the product of this matrix by the specified factor.ComplexMatrixtimes(Matrix<Complex> that)Returns the product of this matrix with the one specified.ComplexVectortimes(Vector<Complex> v)Returns the product of this matrix by the specified vector.ComplexMatrixtranspose()Returns the transpose of this matrix.static ComplexMatrixvalueOf(java.util.List<ComplexVector> rows)Returns a complex matrix holding the row vectors from the specified collection (column vectors iftransposed).static ComplexMatrixvalueOf(Complex[][] elements)Returns a complex matrix from the specified 2-dimensional array.static ComplexMatrixvalueOf(ComplexVector... rows)Returns a complex matrix holding the specified row vectors (column vectors iftransposed).static ComplexMatrixvalueOf(Matrix<Complex> that)Returns a complex matrix equivalent to the specified matrix.ComplexVectorvectorization()Returns the vectorization of this matrix.
-
-
-
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 iftransposed).- 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 iftransposed).- 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:
thator a complex matrix holding the same elements as the specified matrix.
-
getNumberOfRows
public int getNumberOfRows()
Description copied from class:MatrixReturns the number of rowsmfor this matrix.- Specified by:
getNumberOfRowsin classMatrix<Complex>- Returns:
- m, the number of rows.
-
getNumberOfColumns
public int getNumberOfColumns()
Description copied from class:MatrixReturns the number of columnsnfor this matrix.- Specified by:
getNumberOfColumnsin classMatrix<Complex>- Returns:
- n, the number of columns.
-
get
public Complex get(int i, int j)
Description copied from class:MatrixReturns a single element from this matrix.
-
getRow
public ComplexVector getRow(int i)
Description copied from class:MatrixReturns the row identified by the specified index in this matrix.
-
getColumn
public ComplexVector getColumn(int j)
Description copied from class:MatrixReturns the column identified by the specified index in this matrix.
-
getDiagonal
public ComplexVector getDiagonal()
Description copied from class:MatrixReturns the diagonal vector.- Specified by:
getDiagonalin classMatrix<Complex>- Returns:
- the vector holding the diagonal elements.
-
opposite
public ComplexMatrix opposite()
Description copied from class:MatrixReturns the negation of this matrix.
-
plus
public ComplexMatrix plus(Matrix<Complex> that)
Description copied from class:MatrixReturns the sum of this matrix with the one specified.
-
minus
public ComplexMatrix minus(Matrix<Complex> that)
Description copied from class:MatrixReturns the difference between this matrix and the one specified.
-
times
public ComplexMatrix times(Complex k)
Description copied from class:MatrixReturns the product of this matrix by the specified factor.
-
times
public ComplexVector times(Vector<Complex> v)
Description copied from class:MatrixReturns the product of this matrix by the specified vector.
-
times
public ComplexMatrix times(Matrix<Complex> that)
Description copied from class:MatrixReturns the product of this matrix with the one specified.
-
inverse
public ComplexMatrix inverse()
Description copied from class:MatrixReturns the inverse of this matrix (must be square).
-
determinant
public Complex determinant()
Description copied from class:MatrixReturns the determinant of this matrix.- Specified by:
determinantin classMatrix<Complex>- Returns:
- this matrix determinant.
-
transpose
public ComplexMatrix transpose()
Description copied from class:MatrixReturns the transpose of this matrix.
-
cofactor
public Complex cofactor(int i, int j)
Description copied from class:MatrixReturns 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.
-
adjoint
public ComplexMatrix adjoint()
Description copied from class:MatrixReturns 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.
-
tensor
public ComplexMatrix tensor(Matrix<Complex> that)
Description copied from class:MatrixReturns the linear algebraic matrix tensor product of this matrix and another (Kronecker product). The default implementation returns aDenseMatrix.- Specified by:
tensorin classMatrix<Complex>- Parameters:
that- the second matrix.- Returns:
this ⊗ that- See Also:
- Wikipedia: Kronecker Product
-
vectorization
public ComplexVector vectorization()
Description copied from class:MatrixReturns 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 aDenseVector.- Specified by:
vectorizationin classMatrix<Complex>- Returns:
- the vectorization of this matrix.
- See Also:
- Wikipedia: Vectorization.
-
copy
public ComplexMatrix copy()
Description copied from class:MatrixReturns a copy of this matrixallocatedby the calling thread (possibly on the stack).
-
-