jsci.maths.matrices
Class AbstractComplexMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- 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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description AbelianGroup.Memberadd(AbelianGroup.Member m)Returns the addition of this matrix and another.AbstractComplexMatrixadd(AbstractComplexMatrix m)Returns the addition of this matrix and another.AbstractComplexMatrixconjugate()Returns the complex conjugate of this matrix.AbstractComplexMatrixdirectSum(AbstractComplexMatrix m)Returns the direct sum of this matrix and another.booleanequals(AbstractComplexMatrix m)Compares two complex matrices for equality.booleanequals(AbstractComplexMatrix m, double tol)booleanequals(java.lang.Object obj)Compares two complex matrices for equality.doublefrobeniusNorm()Returns the Frobenius or Hilbert-Schmidt (l2) norm.abstract ComplexgetElement(int i, int j)Returns an element of the matrix.abstract doublegetImagElement(int i, int j)Returns the imag part of an element of the matrix.abstract doublegetRealElement(int i, int j)Returns the real part of an element of the matrix.java.lang.ObjectgetSet()inthashCode()Returns a hashcode for this matrix.AbstractComplexMatrixhermitianAdjoint()Returns the hermitian adjoint of this matrix.AbstractDoubleMatriximag()Returns the imaginary part of this complex matrix.doubleinfNorm()Returns the l
-norm.AbstractComplexMatrixmapElements(ComplexMapping f)Applies a function on all the matrix elements.AbstractComplexMatrixmultiply(AbstractComplexMatrix m)Returns the multiplication of this matrix and another.AbstractComplexVectormultiply(AbstractComplexVector v)Returns the multiplication of a vector by this matrix.Ring.Membermultiply(Ring.Member m)Returns the multiplication of this matrix and another.AbelianGroup.Membernegate()Returns the negative of this matrix.AbstractDoubleMatrixreal()Returns the real part of this complex matrix.AbstractComplexMatrixscalarDivide(Complex z)Returns the division of this matrix by a scalar.AbstractComplexMatrixscalarDivide(double x)Returns the division of this matrix by a scalar.VectorSpace.MemberscalarDivide(Field.Member x)Returns the division of this matrix by a scalar.AbstractComplexMatrixscalarMultiply(Complex z)Returns the multiplication of this matrix by a scalar.AbstractComplexMatrixscalarMultiply(double x)Returns the multiplication of this matrix by a scalar.Module.MemberscalarMultiply(Ring.Member x)Returns the multiplication of this matrix by a scalar.ComplexscalarProduct(AbstractComplexMatrix m)Returns the scalar product of this matrix and another.abstract voidsetElement(int i, int j, Complex z)Sets the value of an element of the matrix.abstract voidsetElement(int i, int j, double x, double y)Sets the value of an element of the matrix.AbelianGroup.Membersubtract(AbelianGroup.Member m)Returns the subtraction of this matrix by another.AbstractComplexMatrixsubtract(AbstractComplexMatrix m)Returns the subtraction of this matrix by another.AbstractComplexMatrixtensor(AbstractComplexMatrix m)Returns the tensor product of this matrix and another.java.lang.StringtoString()Returns a string representing this matrix.Matrixtranspose()Returns the transpose of this matrix.
-
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object obj)
Compares two complex matrices for equality.- Overrides:
equalsin classjava.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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hashcode for this matrix.- Overrides:
hashCodein classjava.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 elementj- 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 elementj- 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 elementj- 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 elementj- column index of the elementz- 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 elementj- column index of the elementx- the real part of a complex numbery- 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 l
-norm.
-
frobeniusNorm
public double frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm.
-
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.
-
mapElements
public AbstractComplexMatrix mapElements(ComplexMapping f)
Applies a function on all the matrix elements.- Parameters:
f- a user-defined function- Returns:
- a complex matrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG