jsci.maths.matrices
Class ComplexTridiagonalMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- jsci.maths.matrices.AbstractComplexMatrix
-
- jsci.maths.matrices.AbstractComplexSquareMatrix
-
- jsci.maths.matrices.ComplexTridiagonalMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, Algebra.Member, BanachSpace.Member, CStarAlgebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, SquareMatrix, TridiagonalMatrix, Member
public class ComplexTridiagonalMatrix extends AbstractComplexSquareMatrix implements TridiagonalMatrix
The ComplexTridiagonalMatrix class provides an object for encapsulating tridiagonal matrices containing complex numbers. Uses compressed diagonal storage.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ComplexTridiagonalMatrix(Complex[][] array)Constructs a matrix from an array.ComplexTridiagonalMatrix(int size)Constructs an empty matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AbstractComplexSquareMatrixadd(AbstractComplexSquareMatrix m)Returns the addition of this matrix and another.ComplexSquareMatrixadd(ComplexSquareMatrix m)ComplexTridiagonalMatrixadd(ComplexTridiagonalMatrix m)AbstractComplexMatrixconjugate()Returns the complex conjugate of this matrix.booleanequals(AbstractComplexMatrix m, double tol)Compares two complex matrices for equality.doublefrobeniusNorm()Returns the Frobenius (l2) norm.ComplexgetElement(int i, int j)Returns an element of the matrix.doublegetImagElement(int i, int j)Returns the imag part of an element of the matrix.doublegetRealElement(int i, int j)Returns the real part of an element of the 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.AbstractComplexSquareMatrixmultiply(AbstractComplexSquareMatrix m)Returns the multiplication of this matrix and another.AbstractComplexVectormultiply(AbstractComplexVector v)Returns the multiplication of a vector by this matrix.ComplexSquareMatrixmultiply(ComplexSquareMatrix m)ComplexSquareMatrixmultiply(ComplexTridiagonalMatrix m)Returns the multiplication of this matrix and another.doubleoperatorNorm()Returns the operator norm.AbstractDoubleMatrixreal()Returns the real part of this complex matrix.AbstractComplexMatrixscalarMultiply(Complex z)Returns the multiplication of this matrix by a scalar.AbstractComplexMatrixscalarMultiply(double x)Returns the multiplication of this matrix by a scalar.voidsetElement(int i, int j, Complex z)Sets the value of an element of the matrix.voidsetElement(int i, int j, double x, double y)Sets the value of an element of the matrix.AbstractComplexSquareMatrixsubtract(AbstractComplexSquareMatrix m)Returns the subtraction of this matrix and another.ComplexSquareMatrixsubtract(ComplexSquareMatrix m)ComplexTridiagonalMatrixsubtract(ComplexTridiagonalMatrix m)Returns the subtraction of this matrix and another.java.lang.StringtoString()Returns a string representing this matrix.Complextrace()Returns the trace.Matrixtranspose()Returns the transpose of this matrix.-
Methods inherited from class jsci.maths.matrices.AbstractComplexSquareMatrix
add, det, directSum, inverse, involution, isHermitian, isUnitary, luDecompose, luDecompose, negate, norm, polarDecompose, scalarDivide, scalarDivide, scalarProduct, scalarProduct, subtract, tensor
-
Methods inherited from class jsci.maths.matrices.AbstractComplexMatrix
add, directSum, equals, equals, getSet, hashCode, multiply, multiply, scalarDivide, scalarMultiply, subtract, tensor
-
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
-
-
-
-
Constructor Detail
-
ComplexTridiagonalMatrix
public ComplexTridiagonalMatrix(int size)
Constructs an empty matrix.- Parameters:
size- the number of rows/columns
-
ComplexTridiagonalMatrix
public ComplexTridiagonalMatrix(Complex[][] array)
Constructs a matrix from an array. Any non-tridiagonal elements in the array are ignored.- Parameters:
array- an assigned value- Throws:
MatrixDimensionException- If the array is not square.
-
-
Method Detail
-
equals
public boolean equals(AbstractComplexMatrix m, double tol)
Compares two complex matrices for equality.- Overrides:
equalsin classAbstractComplexMatrix- Parameters:
m- a complex matrix
-
toString
public java.lang.String toString()
Returns a string representing this matrix.- Overrides:
toStringin classAbstractComplexMatrix
-
real
public AbstractDoubleMatrix real()
Returns the real part of this complex matrix.- Overrides:
realin classAbstractComplexSquareMatrix- Returns:
- a double tridiagonal matrix
-
imag
public AbstractDoubleMatrix imag()
Returns the imaginary part of this complex matrix.- Overrides:
imagin classAbstractComplexSquareMatrix- Returns:
- a double tridiagonal matrix
-
getElement
public Complex getElement(int i, int j)
Returns an element of the matrix.- Specified by:
getElementin classAbstractComplexMatrix- Parameters:
i- row index of the elementj- column index of the element- Throws:
MatrixDimensionException- If attempting to access an invalid element.
-
getRealElement
public double getRealElement(int i, int j)Description copied from class:AbstractComplexMatrixReturns the real part of an element of the matrix.- Specified by:
getRealElementin classAbstractComplexMatrix- Parameters:
i- row index of the elementj- column index of the element
-
getImagElement
public double getImagElement(int i, int j)Description copied from class:AbstractComplexMatrixReturns the imag part of an element of the matrix.- Specified by:
getImagElementin classAbstractComplexMatrix- Parameters:
i- row index of the elementj- column index of the element
-
setElement
public 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.- Specified by:
setElementin classAbstractComplexMatrix- 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 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.- Specified by:
setElementin classAbstractComplexMatrix- 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.
-
trace
public Complex trace()
Returns the trace.- Overrides:
tracein classAbstractComplexSquareMatrix
-
infNorm
public double infNorm()
Returns the l
-norm.- Overrides:
infNormin classAbstractComplexMatrix
-
frobeniusNorm
public double frobeniusNorm()
Returns the Frobenius (l2) norm.- Overrides:
frobeniusNormin classAbstractComplexMatrix
-
operatorNorm
public double operatorNorm() throws MaximumIterationsExceededExceptionReturns the operator norm.- Overrides:
operatorNormin classAbstractComplexSquareMatrix- Throws:
MaximumIterationsExceededException- If it takes more than 50 iterations to determine an eigenvalue.
-
add
public AbstractComplexSquareMatrix add(AbstractComplexSquareMatrix m)
Returns the addition of this matrix and another.- Overrides:
addin classAbstractComplexSquareMatrix- Parameters:
m- a complex matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
add
public ComplexSquareMatrix add(ComplexSquareMatrix m)
-
add
public ComplexTridiagonalMatrix add(ComplexTridiagonalMatrix m)
-
subtract
public AbstractComplexSquareMatrix subtract(AbstractComplexSquareMatrix m)
Returns the subtraction of this matrix and another.- Overrides:
subtractin classAbstractComplexSquareMatrix- Parameters:
m- a complex matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
subtract
public ComplexSquareMatrix subtract(ComplexSquareMatrix m)
-
subtract
public ComplexTridiagonalMatrix subtract(ComplexTridiagonalMatrix m)
Returns the subtraction of this matrix and another.- Parameters:
m- a complex tridiagonal matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
scalarMultiply
public AbstractComplexMatrix scalarMultiply(Complex z)
Returns the multiplication of this matrix by a scalar.- Overrides:
scalarMultiplyin classAbstractComplexSquareMatrix- Parameters:
z- a complex number- Returns:
- a complex tridiagonal matrix
-
scalarMultiply
public AbstractComplexMatrix scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar.- Overrides:
scalarMultiplyin classAbstractComplexSquareMatrix- Parameters:
x- a double- Returns:
- a complex tridiagonal matrix
-
multiply
public AbstractComplexVector multiply(AbstractComplexVector v)
Returns the multiplication of a vector by this matrix.- Overrides:
multiplyin classAbstractComplexMatrix- Parameters:
v- a complex vector- Throws:
DimensionException- If the matrix and vector are incompatible.
-
multiply
public AbstractComplexSquareMatrix multiply(AbstractComplexSquareMatrix m)
Returns the multiplication of this matrix and another.- Overrides:
multiplyin classAbstractComplexSquareMatrix- Parameters:
m- a complex matrix- Returns:
- an AbstractComplexMatrix or an AbstractComplexSquareMatrix as appropriate
- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
multiply
public ComplexSquareMatrix multiply(ComplexSquareMatrix m)
-
multiply
public ComplexSquareMatrix multiply(ComplexTridiagonalMatrix m)
Returns the multiplication of this matrix and another.- Parameters:
m- a complex tridiagonal matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
hermitianAdjoint
public AbstractComplexMatrix hermitianAdjoint()
Returns the hermitian adjoint of this matrix.- Overrides:
hermitianAdjointin classAbstractComplexSquareMatrix- Returns:
- a complex tridiagonal matrix
-
conjugate
public AbstractComplexMatrix conjugate()
Returns the complex conjugate of this matrix.- Overrides:
conjugatein classAbstractComplexSquareMatrix- Returns:
- a complex tridiagonal matrix
-
transpose
public Matrix transpose()
Returns the transpose of this matrix.- Overrides:
transposein classAbstractComplexSquareMatrix- Returns:
- a complex tridiagonal matrix
-
mapElements
public AbstractComplexMatrix mapElements(ComplexMapping f)
Applies a function on all the matrix elements.- Overrides:
mapElementsin classAbstractComplexSquareMatrix- Parameters:
f- a user-defined function- Returns:
- a complex tridiagonal matrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG