public class SymmetricMatrix extends AbstractRealMatrix implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
SymmetricMatrix.SYMMETRIC
Enumerate to fill in a symmetric matrix only by its lower/upper part.
|
Constructor and Description |
---|
SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn,
int nIn,
int ldIn)
Creates a matrix with the supplied dimensions.
|
SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn,
int nIn,
int ldIn,
double[] dIn)
Creates a matrix given the supplied dimensions and data array.
|
SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn,
int nIn,
int ldIn,
double[][] d)
Creates a matrix given the supplied dimensions and data array 2D.
|
SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn,
int nIn,
int ldIn,
double[] d,
boolean copyArray)
Creates a matrix given the supplied dimensions and data array.
|
SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn,
int nIn,
int ldIn,
RealMatrix m)
Creates a symmetric matrix using a real matrix.
|
Modifier and Type | Method and Description |
---|---|
SymmetricMatrix |
add(DiagonalMatrix m)
Compute the sum of this and
m . |
RealMatrix |
add(RealMatrix m)
Returns the sum of
this and m . |
SymmetricMatrix |
add(SymmetricMatrix m)
Compute the sum of this and
m . |
void |
addToEntry(int row,
int column,
double increment)
Adds (in place) the specified value to the specified entry of
this matrix. |
SymmetricMatrix |
copy()
Returns a (deep) copy of this.
|
static SymmetricMatrix |
createDiagonalMatrixWithArray(int dim,
int lda,
double[] coeff)
Creates an instance of SymmetricMatrix which is diagonal of input element.
|
SymmetricMatrix |
createMatrix(int lda,
int dim)
Create a new RealMatrix of the same type as the instance with the
supplied
row and column dimensions.
|
int |
getColumnDimension()
Returns the number of columns of this matrix.
|
double |
getEntry(int row,
int column)
Get the entry in the specified row and column.
|
int |
getRowDimension()
Returns the number of rows of this matrix.
|
boolean |
isSymmetric()
Checks if this is a symmetric matrix
|
RealMatrix |
multiply(DiagonalMatrix m)
Returns the result of postmultiplying this by
m . |
RealMatrix |
multiply(RealMatrix m)
Returns the result of postmultiplying
this by m . |
RealMatrix |
multiply(SymmetricMatrix m)
Returns the result of postmultiplying this by
m . |
void |
multiplyEntry(int row,
int column,
double factor)
Multiplies (in place) the specified entry of
this matrix by the
specified value. |
static SymmetricMatrix |
newByCopy(SymmetricMatrix.SYMMETRIC uplo,
int n,
int ld,
SymmetricMatrix.SYMMETRIC uploMat,
RealMatrix mat)
Create a symmetric matrix by copy of a triangle of a matrix.
|
static SymmetricMatrix |
newByCopyAndSymmetrize(SymmetricMatrix.SYMMETRIC uplo,
int n,
int ld,
RealMatrix mat)
Create a symmetric matrix by computation of the mean of the 2 triangles of a matrix.
|
static SymmetricMatrix |
newByCopyOfPackedStorage(SymmetricMatrix.SYMMETRIC uplo,
int n,
int ld,
double[] d)
Creates a symmetric matrix using one of the triangles stored in 'packed'
storage.
|
SymmetricMatrix |
scalarMultiply(double d)
Returns the result of multiplying each entry of
this by d . |
void |
setEntry(int row,
int column,
double value)
Set the entry in the specified row and column.
|
void |
setSubMatrix(double[][] subMatrix,
int row,
int column)
Replace the submatrix starting at
row, column using data in the
input subMatrix array. |
void |
setSubMatrixWithMatrix(RealMatrix subMatrix,
int row,
int column)
Method setSubMatrix using a RealMatrix for subMatrix instead of an array
|
SymmetricMatrix |
subtract(DiagonalMatrix m)
Compute this minus
m . |
RealMatrix |
subtract(RealMatrix m)
Returns
this minus m . |
SymmetricMatrix |
subtract(SymmetricMatrix m)
Compute this minus
m . |
static void |
symmetricMatrixOperation(double alpha,
SymmetricMatrix symA,
RealMatrix matB,
double beta,
RealMatrix matC)
Performs the matrix-matrix operations C := alpha*A*B + beta*C
where alpha and beta are scalars, A is a symmetric matrix and B and C are n by n matrices.
|
RealMatrix |
transpose()
Returns the transpose of this matrix.
|
copySubMatrix, copySubMatrix, equals, getColumn, getColumnMatrix, getColumnVector, getData, getFrobeniusNorm, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, isAntisymmetric, isDiagonal, isInvertible, isOrthogonal, isSquare, isSymmetric, operate, operate, power, preMultiply, preMultiply, preMultiply, scalarAdd, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, toString, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder
isTransposable, operateTranspose
public SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn, int nIn, int ldIn)
uploIn
- the triangle that will be usednIn
- the dimension of the matrixldIn
- the leading dimension of the matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementspublic SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn, int nIn, int ldIn, double[] d, boolean copyArray)
uploIn
- the triangle that will be usednIn
- the dimension of the matrixldIn
- the leading dimension of the matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsd
- the array to be viewed as a conventional full storage
symmetric matrixcopyArray
- if the array must be copiedpublic SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn, int nIn, int ldIn, double[] dIn)
uploIn
- the triangle that will be usednIn
- the dimension of the matrixldIn
- the leading dimension of the matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsdIn
- the array to be viewed as a conventional full storage
symmetric matrixNonSquareMatrixException
- if matrix is not squarepublic SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn, int nIn, int ldIn, double[][] d)
newByCopy(SYMMETRIC, int, int, SYMMETRIC, RealMatrix)
.uploIn
- the triangle that will be usednIn
- the dimension of the matrixldIn
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsd
- data for the new matrixNonSquareMatrixException
- if matrix is not squarepublic SymmetricMatrix(SymmetricMatrix.SYMMETRIC uploIn, int nIn, int ldIn, RealMatrix m)
uploIn
- the triangle that will be usednIn
- the dimension of the matrixldIn
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsm
- the real matrix to be usedNonSquareMatrixException
- if matrix is not squarepublic static SymmetricMatrix newByCopy(SymmetricMatrix.SYMMETRIC uplo, int n, int ld, SymmetricMatrix.SYMMETRIC uploMat, RealMatrix mat)
uplo
- the triangle to usen
- the dimension of the created matrixld
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsuploMat
- the triangle to use from the input matrixmat
- the matrix from which the data are extractedNonSquareMatrixException
- if matrix is not squarepublic static SymmetricMatrix newByCopyAndSymmetrize(SymmetricMatrix.SYMMETRIC uplo, int n, int ld, RealMatrix mat)
uplo
- the triangle to usen
- the dimension of the created matrixld
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsmat
- the matrix from which the data are extractedpublic static SymmetricMatrix newByCopyOfPackedStorage(SymmetricMatrix.SYMMETRIC uplo, int n, int ld, double[] d)
uplo
- lower/upper known part of the matrixn
- the dimension of the created matrixld
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementsd
- data in 'packed storage'NonSquareMatrixException
- if matrix is not squarepublic SymmetricMatrix createMatrix(int lda, int dim)
createMatrix
in interface RealMatrix
createMatrix
in class AbstractRealMatrix
lda
- the number of rows in the new matrixdim
- the number of columns in the new matrixpublic static SymmetricMatrix createDiagonalMatrixWithArray(int dim, int lda, double[] coeff)
dim
- the dimension of the created matrixlda
- the leading dimension of the created matrix. ld is normaly equal to n. It can be set larger
in some case for performance improvementscoeff
- value of diagonals elementsNotStrictlyPositiveException
- if n or ld are not positivepublic SymmetricMatrix copy()
copy
in interface RealMatrix
copy
in class AbstractRealMatrix
public RealMatrix transpose()
transpose
in interface RealMatrix
transpose
in class AbstractRealMatrix
public static void symmetricMatrixOperation(double alpha, SymmetricMatrix symA, RealMatrix matB, double beta, RealMatrix matC)
alpha
- the first value to use in above linear combinationsymA
- the input symmetric matrixmatB
- the input matrix, instance of RealMatrixbeta
- the second value to use in above linear combinationmatC
- the input/output matrix, instance of RealMatrixpublic SymmetricMatrix add(SymmetricMatrix m)
m
.m
- matrix to be addedDimensionMismatchException
- if m is not the same size as thispublic SymmetricMatrix add(DiagonalMatrix m)
m
.m
- Diagonal matrix to be addedIllegalArgumentException
- if m is not the same size as thispublic RealMatrix add(RealMatrix m)
this
and m
.add
in interface RealMatrix
add
in class AbstractRealMatrix
m
- matrix to be addedthis + m
public SymmetricMatrix subtract(SymmetricMatrix m)
m
.m
- matrix to be subtractedIllegalArgumentException
- if m is not the same size as thispublic SymmetricMatrix subtract(DiagonalMatrix m)
m
.m
- Diagonal matrix to be addedIllegalArgumentException
- if m is not the same size as thispublic RealMatrix subtract(RealMatrix m)
this
minus m
.subtract
in interface RealMatrix
subtract
in class AbstractRealMatrix
m
- matrix to be subtractedthis - m
public RealMatrix multiply(SymmetricMatrix m)
m
.m
- matrix to postmultiply byIllegalArgumentException
- if columnDimension(this) != rowDimension(m)public RealMatrix multiply(DiagonalMatrix m)
m
.m
- Diagonal matrix to postmultiply byIllegalArgumentException
- if columnDimension(this) != rowDimension(m)public RealMatrix multiply(RealMatrix m)
this
by m
.multiply
in interface RealMatrix
multiply
in class AbstractRealMatrix
m
- matrix to postmultiply bythis * m
public SymmetricMatrix scalarMultiply(double d)
this
by d
.scalarMultiply
in interface RealMatrix
scalarMultiply
in class AbstractRealMatrix
d
- value to multiply all entries byd * this
public void setSubMatrix(double[][] subMatrix, int row, int column)
row, column
using data in the
input subMatrix
array. Indexes are 0-based.
Example:
Starting with
1 2 3 4 5 6 7 8 9 0 1 2and
subMatrix = {{3, 4} {5,6}}
, invoking setSubMatrix(subMatrix,1,1))
will result in
1 2 3 4 5 3 4 8 9 5 6 2
setSubMatrix
in interface RealMatrix
setSubMatrix
in class AbstractRealMatrix
subMatrix
- array containing the submatrix replacement datarow
- row coordinate of the top, left element to be replacedcolumn
- column coordinate of the top, left element to be replacedpublic void setSubMatrixWithMatrix(RealMatrix subMatrix, int row, int column)
subMatrix
- matrix containing the submatrix replacement datarow
- row coordinate of the top, left element to be replacedcolumn
- column coordinate of the top, left element to be replacedNoDataException
- if subMatrix
is empty.OutOfRangeException
- if subMatrix
does not fit into
this matrix from element in (row, column)
.DimensionMismatchException
- if subMatrix
is not rectangular
(not all rows have the same length) or empty.NullArgumentException
- if subMatrix
is null
.public double getEntry(int row, int column)
getEntry
in interface RealMatrix
getEntry
in class AbstractRealMatrix
row
- Row index of entry to be fetched.column
- Column index of entry to be fetched.(row, column)
.public void setEntry(int row, int column, double value)
setEntry
in interface RealMatrix
setEntry
in class AbstractRealMatrix
row
- Row index of entry to be set.column
- Column index of entry to be set.value
- the new value of the entry.public void addToEntry(int row, int column, double increment)
this
matrix. Row and column indices start
at 0.addToEntry
in interface RealMatrix
addToEntry
in class AbstractRealMatrix
row
- Row index of the entry to be modified.column
- Column index of the entry to be modified.increment
- value to add to the matrix entry.public void multiplyEntry(int row, int column, double factor)
this
matrix by the
specified value. Row and column indices start at 0.multiplyEntry
in interface RealMatrix
multiplyEntry
in class AbstractRealMatrix
row
- Row index of the entry to be modified.column
- Column index of the entry to be modified.factor
- Multiplication factor for the matrix entry.public int getRowDimension()
getRowDimension
in interface AnyMatrix
getRowDimension
in class AbstractRealMatrix
public int getColumnDimension()
getColumnDimension
in interface AnyMatrix
getColumnDimension
in class AbstractRealMatrix
public boolean isSymmetric()
isSymmetric
in interface RealMatrix
isSymmetric
in class AbstractRealMatrix
Copyright © 2018 CNES. All Rights Reserved.