public interface SymmetricMatrix extends RealMatrix
Modifier and Type | Method and Description |
---|---|
SymmetricMatrix |
add(SymmetricMatrix m)
Returns the result of adding the symmetric matrix
m to this matrix. |
SymmetricMatrix |
copy()
Returns a deep copy of this matrix.
|
SymmetricMatrix |
createMatrix(int rowDimension,
int columnDimension)
Creates a new matrix of the same type as this matrix.
|
double[] |
getDiagonal()
Gets the diagonal vector from this matrix.
|
SymmetricMatrix |
getInverse()
Gets the inverse (or pseudo-inverse) of this matrix using the default decomposition.
|
SymmetricMatrix |
getInverse(Function<RealMatrix,Decomposition> decompositionBuilder)
Gets the inverse (or pseudo-inverse) of this matrix using the given decomposition algorithm.
|
SymmetricMatrix |
getSubMatrix(int[] indices)
Extracts the submatrix corresponding to the specified indices.
|
SymmetricMatrix |
getSubMatrix(int startIndex,
int endIndex)
Extracts the submatrix corresponding to the specified indices.
|
SymmetricMatrix |
power(int p)
Returns the the result of multiplying this matrix with itself
p times. |
SymmetricMatrix |
quadraticMultiplication(RealMatrix m)
Returns the result of the quadratic multiplication M×
this ×MT,
where M is the provided matrix. |
SymmetricMatrix |
quadraticMultiplication(RealMatrix m,
boolean isTranspose)
Returns the result of the quadratic multiplication M×
this ×MT,
where M or MT is the provided matrix. |
SymmetricMatrix |
scalarAdd(double d)
Returns the result of adding a scalar
d to the entries of this matrix. |
SymmetricMatrix |
scalarMultiply(double d)
Returns the result of multiplying the entries of this matrix by the scalar
d . |
SymmetricMatrix |
subtract(SymmetricMatrix m)
Returns the result of subtracting the symmetric matrix
m from this matrix. |
SymmetricMatrix |
transpose()
Returns the transpose of this matrix.
|
SymmetricMatrix |
transpose(boolean forceCopy)
Returns the transpose of this matrix.
|
add, addToEntry, concatenateDiagonally, concatenateDiagonally, concatenateDiagonally, concatenateHorizontally, concatenateHorizontally, concatenateVertically, concatenateVertically, copySubMatrix, copySubMatrix, copySubMatrix, copySubMatrix, equals, getColumn, getColumnMatrix, getColumnVector, getData, getData, getDefaultDecomposition, getEntry, getFrobeniusNorm, getMax, getMin, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, isAntisymmetric, isDiagonal, isInvertible, isOrthogonal, isSymmetric, isSymmetric, isSymmetric, multiply, multiply, multiply, multiplyEntry, operate, operate, preMultiply, preMultiply, preMultiply, setColumn, setColumnMatrix, setColumnVector, setDefaultDecomposition, setEntry, setRow, setRowMatrix, setRowVector, setSubMatrix, subtract, toString, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder
getColumnDimension, getRowDimension, isSquare
SymmetricMatrix add(SymmetricMatrix m)
m
to this matrix.m
- the matrix to be addedthis
+m
MatrixDimensionMismatchException
- if the matrix m
is not the same size as this matrixSymmetricMatrix subtract(SymmetricMatrix m)
m
from this matrix.m
- the matrix to be subtractedthis
-m
MatrixDimensionMismatchException
- if the matrix m
is not the same size as this matrixSymmetricMatrix scalarAdd(double d)
d
to the entries of this matrix.scalarAdd
in interface RealMatrix
d
- the scalar value to be added to the entries of this matrixthis
+d
SymmetricMatrix scalarMultiply(double d)
d
.scalarMultiply
in interface RealMatrix
d
- the scalar value by which to multiply the entries of this matrix bythis
×d
SymmetricMatrix quadraticMultiplication(RealMatrix m)
this
×MT,
where M is the provided matrix.m
- the matrix Mthis
×MTSymmetricMatrix quadraticMultiplication(RealMatrix m, boolean isTranspose)
this
×MT,
where M or MT is the provided matrix.m
- the matrix M or the matrix MTisTranspose
- if true
, assumes the provided matrix is MT, otherwise assumes it is
Mthis
×MTSymmetricMatrix getSubMatrix(int startIndex, int endIndex)
This method uses the same start/end indices to select the rows and columns to be extracted. These indices must be valid indices with respect to the dimensions of the matrix (valid indices range from 0 to n-1, with n the row/column dimension of the matrix). Calling this method is equivalent to calling RealMatrix.getSubMatrix(int, int, int, int) using the same start/end indices for the rows and columns. The extracted submatrix is guaranteed to be symmetric. It will also remain positive semi-definite if the initial matrix originally is.
Usage examples:
// Initial matrix matrix = [a00, a10, a20] [a10, a11, a21] [a20, a21, a22] // Submatrix extraction matrix.getSubMatrix(1, 2) => [a11, a21] [a21, a22]
startIndex
- the initial row/column indexendIndex
- the final row/column index (inclusive)SymmetricMatrix getSubMatrix(int[] indices)
This method uses a single index array to select the rows and columns to be extracted. All indices must be valid indices with respect to the dimensions of the matrix (valid indices range from 0 to n-1, with n the row/column dimension of the matrix). The provided index array is allowed to contain duplicates. Calling this method is equivalent to calling RealMatrix.getSubMatrix(int[], int[]) using the provided index array for the selected rows and columns. This method can be used to extract any submatrix and perform a symmetric reordering of its rows/columns. The extracted submatrix is guaranteed to be symmetric. It will also remain positive semi-definite if the initial matrix originally is.
Usage examples:
// Initial matrix matrix = [a00, a10, a20] [a10, a11, a21] [a20, a21, a22] // Submatrix extraction matrix.getSubMatrix([1, 2]) => [a11, a21] [a21, a22] // Rows/Columns permutation matrix.getSubMatrix([1, 2, 0]) => [a11, a21, a10] [a21, a22, a20] [a10, a20, a00] // Submatrix extraction (with duplicated indices) matrix.getSubMatrix([1, 2, 0, 1, 0]) => [a11, a21, a10, a11, a10] [a21, a22, a20, a21, a20] [a10, a20, a00, a10, a00] [a11, a21, a10, a11, a10] [a10, a20, a00, a10, a00]
indices
- the selected indicesdouble[] getDiagonal()
getDiagonal
in interface RealMatrix
SymmetricMatrix copy()
copy
in interface RealMatrix
SymmetricMatrix transpose()
transpose
in interface RealMatrix
SymmetricMatrix transpose(boolean forceCopy)
If forceCopy
is true
, the returned matrix is guaranteed to be a new instance,
which can be modified without any risk of impacting the current instance. Otherwise, this
method may simply return the current instance when the matrix is its own transpose (symmetric
matrix).
transpose
in interface RealMatrix
forceCopy
- if true
, the transpose of the matrix is systematically stored in a new matrix;
otherwise the method may return the current instance when the matrix is its own
transposeSymmetricMatrix power(int p)
p
times.
The exponent p
must be positive or equal to zero.
This operation is only supported for square matrices.
Depending on the underlying storage, numerical instabilities might occur for high powers.
power
in interface RealMatrix
p
- the exponent p
to which this matrix is to be raisedp
SymmetricMatrix getInverse()
The default decomposition builder can be changed using the
setDefaultDecomposition
method.
getInverse
in interface RealMatrix
RealMatrix.getDefaultDecomposition()
,
RealMatrix.setDefaultDecomposition(Function)
SymmetricMatrix getInverse(Function<RealMatrix,Decomposition> decompositionBuilder)
The decomposition builder is a function capable of generating new instances of the decomposition algorithm to be used for the computation of the inverse matrix (like the QRDecomposition or the EigenDecomposition, for instance).
getInverse
in interface RealMatrix
decompositionBuilder
- the decomposition builder to useSymmetricMatrix createMatrix(int rowDimension, int columnDimension)
The returned matrix is filled with zeros. Its size is determined by the specified row and column dimensions, which must both be strictly positive. Additional constraints on the dimensions may apply depending on the implementation (for example, symmetric matrices must be square, which implies that the row and column dimensions must be equal).
Since the matrix build is a symmetric matrix, the row and column dimensions are expected to be equal.
createMatrix
in interface RealMatrix
rowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrixCopyright © 2023 CNES. All rights reserved.