jsci.maths.matrices
Class AbstractDoubleSquareMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- jsci.maths.matrices.AbstractDoubleMatrix
-
- jsci.maths.matrices.AbstractDoubleSquareMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, SquareMatrix, Member
- Direct Known Subclasses:
- DoubleDiagonalMatrix, DoubleSparseSquareMatrix, DoubleSquareMatrix, DoubleTridiagonalMatrix
public abstract class AbstractDoubleSquareMatrix extends AbstractDoubleMatrix implements SquareMatrix
The AbstractDoubleSquareMatrix class provides an object for encapsulating double square matrices.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AbstractDoubleMatrixadd(AbstractDoubleMatrix m)Returns the addition of this matrix and another.AbstractDoubleSquareMatrixadd(AbstractDoubleSquareMatrix m)Returns the addition of this matrix and another.AbstractDoubleSquareMatrix[]choleskyDecompose()Returns the Cholesky decomposition of this matrix.doubledet()Returns the determinant.AbstractDoubleSquareMatrixdirectSum(AbstractDoubleSquareMatrix m)Returns the direct sum of this matrix and another.AbstractDoubleSquareMatrixinverse()Returns the inverse of this matrix.booleanisSymmetric()Returns true if this matrix is symmetric.booleanisUnitary()Returns true if this matrix is unitary.AbstractDoubleSquareMatrix[]luDecompose()Returns the LU decomposition of this matrix.AbstractDoubleSquareMatrix[]luDecompose(int[] pivot)Returns the LU decomposition of this matrix.AbstractDoubleMatrixmapElements(Mapping f)Applies a function on all the matrix elements.AbstractDoubleSquareMatrixmultiply(AbstractDoubleSquareMatrix m)Returns the multiplication of this matrix and another.AbelianGroup.Membernegate()Returns the negative of this matrix.doubleoperatorNorm()Returns the operator norm.AbstractDoubleSquareMatrix[]polarDecompose()Returns the polar decomposition of this matrix.AbstractDoubleSquareMatrix[]qrDecompose()Returns the QR decomposition of this matrix.AbstractDoubleMatrixscalarDivide(double x)Returns the division of this matrix by a scalar.AbstractDoubleMatrixscalarMultiply(double x)Returns the multiplication of this matrix by a scalar.doublescalarProduct(AbstractDoubleMatrix m)Returns the scalar product of this matrix and another.doublescalarProduct(AbstractDoubleSquareMatrix m)Returns the scalar product of this matrix and another.AbstractDoubleSquareMatrix[]singularValueDecompose()Returns the singular value decomposition of this matrix.AbstractDoubleMatrixsubtract(AbstractDoubleMatrix m)Returns the subtraction of this matrix and another.AbstractDoubleSquareMatrixsubtract(AbstractDoubleSquareMatrix m)Returns the subtraction of this matrix by another.AbstractDoubleSquareMatrixtensor(AbstractDoubleSquareMatrix m)Returns the tensor product of this matrix and another.AbstractComplexMatrixtoComplexMatrix()Converts this matrix to a complex matrix.AbstractIntegerMatrixtoIntegerMatrix()Converts this matrix to an integer matrix.doubletrace()Returns the trace.Matrixtranspose()Returns the transpose of this matrix.-
Methods inherited from class jsci.maths.matrices.AbstractDoubleMatrix
add, directSum, equals, equals, equals, frobeniusNorm, getElement, getSet, hashCode, infNorm, multiply, multiply, multiply, scalarDivide, scalarMultiply, setElement, subtract, tensor, toString
-
-
-
-
Method Detail
-
toIntegerMatrix
public AbstractIntegerMatrix toIntegerMatrix()
Converts this matrix to an integer matrix.- Overrides:
toIntegerMatrixin classAbstractDoubleMatrix- Returns:
- an integer square matrix
-
toComplexMatrix
public AbstractComplexMatrix toComplexMatrix()
Converts this matrix to a complex matrix.- Overrides:
toComplexMatrixin classAbstractDoubleMatrix- Returns:
- a complex square matrix
-
isSymmetric
public boolean isSymmetric()
Returns true if this matrix is symmetric.
-
isUnitary
public boolean isUnitary()
Returns true if this matrix is unitary.
-
det
public double det()
Returns the determinant.
-
trace
public double trace()
Returns the trace.
-
operatorNorm
public double operatorNorm() throws MaximumIterationsExceededExceptionReturns the operator norm.- Throws:
MaximumIterationsExceededException- If it takes more than 50 iterations to determine an eigenvalue.
-
negate
public AbelianGroup.Member negate()
Returns the negative of this matrix.- Specified by:
negatein interfaceAbelianGroup.Member- Overrides:
negatein classAbstractDoubleMatrix
-
add
public final AbstractDoubleMatrix add(AbstractDoubleMatrix m)
Returns the addition of this matrix and another.- Overrides:
addin classAbstractDoubleMatrix- Parameters:
m- a double square matrix- Throws:
MatrixDimensionException- If the matrices are not square or different sizes.
-
add
public AbstractDoubleSquareMatrix add(AbstractDoubleSquareMatrix m)
Returns the addition of this matrix and another.- Parameters:
m- a double square matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
subtract
public final AbstractDoubleMatrix subtract(AbstractDoubleMatrix m)
Returns the subtraction of this matrix and another.- Overrides:
subtractin classAbstractDoubleMatrix- Parameters:
m- a double square matrix- Throws:
MatrixDimensionException- If the matrices are not square or different sizes.
-
subtract
public AbstractDoubleSquareMatrix subtract(AbstractDoubleSquareMatrix m)
Returns the subtraction of this matrix by another.- Parameters:
m- a double square matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
scalarMultiply
public AbstractDoubleMatrix scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar.- Overrides:
scalarMultiplyin classAbstractDoubleMatrix- Parameters:
x- a double.- Returns:
- a double square matrix.
-
scalarDivide
public AbstractDoubleMatrix scalarDivide(double x)
Returns the division of this matrix by a scalar.- Overrides:
scalarDividein classAbstractDoubleMatrix- Parameters:
x- a double.- Returns:
- a double square matrix.
-
scalarProduct
public final double scalarProduct(AbstractDoubleMatrix m)
Returns the scalar product of this matrix and another.- Overrides:
scalarProductin classAbstractDoubleMatrix- Parameters:
m- a double square matrix.- Throws:
MatrixDimensionException- If the matrices are not square or different sizes.
-
scalarProduct
public double scalarProduct(AbstractDoubleSquareMatrix m)
Returns the scalar product of this matrix and another.- Parameters:
m- a double square matrix.- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
multiply
public AbstractDoubleSquareMatrix multiply(AbstractDoubleSquareMatrix m)
Returns the multiplication of this matrix and another.- Parameters:
m- a double square matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
directSum
public AbstractDoubleSquareMatrix directSum(AbstractDoubleSquareMatrix m)
Returns the direct sum of this matrix and another.
-
tensor
public AbstractDoubleSquareMatrix tensor(AbstractDoubleSquareMatrix m)
Returns the tensor product of this matrix and another.
-
transpose
public Matrix transpose()
Returns the transpose of this matrix.- Overrides:
transposein classAbstractDoubleMatrix- Returns:
- a double square matrix
-
inverse
public AbstractDoubleSquareMatrix inverse()
Returns the inverse of this matrix.- Returns:
- a double square matrix.
-
luDecompose
public AbstractDoubleSquareMatrix[] luDecompose(int[] pivot)
Returns the LU decomposition of this matrix.- Parameters:
pivot- an empty array of lengthrows()+1to hold the pivot information (null if not interested). The last array element will contain the parity.- Returns:
- an array with [0] containing the L-matrix and [1] containing the U-matrix.
-
luDecompose
public AbstractDoubleSquareMatrix[] luDecompose()
Returns the LU decomposition of this matrix. Warning: no pivoting.- Returns:
- an array with [0] containing the L-matrix and [1] containing the U-matrix.
-
choleskyDecompose
public AbstractDoubleSquareMatrix[] choleskyDecompose()
Returns the Cholesky decomposition of this matrix. Matrix must be symmetric and positive definite.- Returns:
- an array with [0] containing the L-matrix and [1] containing the U-matrix.
-
qrDecompose
public AbstractDoubleSquareMatrix[] qrDecompose()
Returns the QR decomposition of this matrix. Based on the code from JAMA (public domain).- Returns:
- an array with [0] containing the Q-matrix and [1] containing the R-matrix.
-
singularValueDecompose
public AbstractDoubleSquareMatrix[] singularValueDecompose()
Returns the singular value decomposition of this matrix. Based on the code from JAMA (public domain).- Returns:
- an array with [0] containing the U-matrix, [1] containing the S-matrix and [2] containing the V-matrix.
-
polarDecompose
public AbstractDoubleSquareMatrix[] polarDecompose()
Returns the polar decomposition of this matrix.
-
mapElements
public AbstractDoubleMatrix mapElements(Mapping f)
Applies a function on all the matrix elements.- Overrides:
mapElementsin classAbstractDoubleMatrix- Parameters:
f- a user-defined function- Returns:
- a double square matrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG