public class SymmetricMatrix3d extends Matrix3dBase
Matrix.Partition, Matrix.WriteFormat| Modifier and Type | Field and Description |
|---|---|
static SymmetricMatrix3d |
IDENTITY
Global identity matrix.
|
static SymmetricMatrix3d |
ZERO
Global zero matrix.
|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC| Constructor and Description |
|---|
SymmetricMatrix3d()
Creates a symmetric matrix and initializes it to zero.
|
SymmetricMatrix3d(double[] vals)
Creates a symmetric matrix and initializes its elements from an array of
doubles.
|
SymmetricMatrix3d(double m00,
double m11,
double m22,
double m01,
double m02,
double m12)
Creates a symmetric matrix and initializes its elements from the specified
diagonal and uppper off-diagonal values.
|
SymmetricMatrix3d(Matrix3dBase M)
Creates a symmetric matrix and initializes its elements from the diagonal
and upper off-diagonal elements of M.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(SymmetricMatrix3d M1)
Adds this matrix to M1 and places the result in this matrix.
|
void |
add(SymmetricMatrix3d M1,
SymmetricMatrix3d M2)
Adds matrix M1 to M2 and places the result in this matrix.
|
void |
addDyad(Vector3d a)
Adds the dyad
|
void |
addScaledDyad(double s,
Vector3d a)
Adds the scaled dyad
|
void |
addScaledSymmetricDyad(double s,
Vector3d a,
Vector3d b)
Adds the scaled symmetric dyad
|
void |
addSymmetricDyad(Vector3d a,
Vector3d b)
Adds the symmetric dyad
|
void |
deviator()
Sets this matrix to its deviator.
|
void |
deviator(SymmetricMatrix3d M)
Sets this matrix to the deviator of a given symmetric matrix,
where the deviator is defined by
|
void |
dyad(Vector3d a)
Sets this matrix to the dyad
|
double |
fastInvert(Matrix3dBase M)
Quickly inverts the matrix M using the determinant formula and returns
the computed determinant.
|
void |
getCholesky(Matrix3d L)
Computes the Cholesky decomposition of this matrix, which is assumed to be
positive definite.
|
void |
getEigenValues_old(Vector3d eig,
Matrix3dBase V)
Quickly computes the eigenvalues of this symmetric matrix.
|
void |
getEigenValues(double[] eig) |
void |
getEigenValues(Vector3d eig)
Quickly computes the eigenvalues of this symmetric matrix, as described
for
getEigenValues. |
void |
getEigenValues(Vector3d eig,
Matrix3dBase U) |
void |
getSVD(Matrix3dBase U,
Vector3d sig,
Matrix3dBase V)
Quickly computes the singular value decomposition U S V' of this symmetric
matrix.
|
boolean |
invert()
Inverts this matrix in place, returning false if the matrix is detected to
be singular.
|
boolean |
invert(Matrix3dBase M)
Inverts the matrix M and places the result in this matrix, return false if
M is detected to be singular.
|
void |
mulDiagTransposeRight(Matrix3dBase M,
Vector3d diag)
Computes M D M', where D is a diagonal matrix given be a vector, and
places the result in this matrix.
|
void |
mulLeftAndTransposeRight(Matrix3dBase M)
Computes M T M', where T is this matrix, and M' is the transpose of M, and
places the result in this matrix.
|
void |
mulSymmetric(Matrix3dBase A,
Matrix3dBase B)
Computes the symmetric product (AB + B'A')/2 and places the result in this matrix
|
void |
mulTransposeLeft(Matrix3dBase M)
Computes M' M, where M is a supplied matrix and M' is its transpose, and
places the (symmetric) result in this matrix.
|
void |
mulTransposeLeftAndRight(Matrix3dBase M)
Computes M' T M, where T is this matrix, and M' is the transpose of M, and
places the result in this matrix.
|
void |
mulTransposeLeftSymmetric(Matrix3dBase A,
Matrix3dBase B)
Computes the symmetric product (A'B + B'A)/2 and places the result in this matrix
|
void |
mulTransposeRight(Matrix3dBase M)
Computes M M', where M is a supplied matrix and M' is its transpose, and
places the (symmetric) result in this matrix.
|
void |
mulTransposeRightSymmetric(Matrix3dBase A,
Matrix3dBase B)
Computes the symmetric product (AB' + BA')/2 and places the result in this matrix
|
void |
negate(SymmetricMatrix3d M1)
Sets this matrix to the negative of M1.
|
void |
scale(double s)
Scales the elements of this matrix by
s. |
void |
scale(double s,
SymmetricMatrix3d M1)
Scales the elements of matrix M1 by
s and places the
results in this matrix. |
void |
scaledAdd(double s,
SymmetricMatrix3d M1)
Computes s M1 and adds the result to this matrix.
|
void |
scaledAdd(double s,
SymmetricMatrix3d M1,
SymmetricMatrix3d M2)
Computes s M1 + M2 and places the result in this matrix.
|
void |
set(double[] vals)
Sets the elements of this matrix from an array of doubles.
|
void |
set(double m00,
double m11,
double m22,
double m01,
double m02,
double m12)
Sets the values of this matrix from the specified diagonal and uppper
off-diagonal values.
|
void |
set(Matrix3dBase M)
Sets the elements of this matrix from the the diagonal and upper
off-diagonal elements of M.
|
void |
setDiagonal(double[] vals)
Sets this matrix to a diagonal matrix whose values are specified by the
array vals.
|
void |
setDiagonal(Vector3d diag)
Sets this matrix to a diagonal matrix whose values are specified by diag.
|
void |
setRandom()
Sets the elements of this matrix to uniformly distributed random values in
the range -0.5 (inclusive) to 0.5 (exclusive).
|
void |
setRandom(double lower,
double upper)
Sets the elements of this matrix to uniformly distributed random values in
a specified range.
|
void |
setRandom(double lower,
double upper,
java.util.Random generator)
Sets the elements of this matrix to uniformly distributed random values in
a specified range, using a supplied random number generator.
|
void |
setSymmetric(Matrix3dBase M)
Sets this matrix to the symmetric part of M, defined by
|
void |
setZero()
Sets the elements of this matrix to zero.
|
void |
sub(SymmetricMatrix3d M1)
Subtracts this matrix from M1 and places the result in this matrix.
|
void |
sub(SymmetricMatrix3d M1,
SymmetricMatrix3d M2)
Subtracts matrix M1 from M2 and places the result in this matrix.
|
void |
symmetricDyad(Vector3d a,
Vector3d b)
Sets this matrix to the symmetric dyad
|
clone, colSize, determinant, epsilonEquals, equals, factorQR, frobeniusNorm, get, get, getColumn, getColumn, getColumn, getRow, getRow, getRow, infinityNorm, inverseTransform, isIdentity, isSymmetric, main, mul, mul, mul, mul, mulAdd, mulAdd, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, mulTransposeAdd, negate, negateColumn, negateRow, oneNorm, orthogonalDeterminant, rowSize, scaleColumn, scaleRow, set, set, setColumn, setColumn, setIdentity, setRow, setRow, solve, solveTranspose, trace, transposeadd, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrixcontainsNaN, epsilonEquals, equals, frobeniusNormSquared, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, isFixedSize, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, write, write, write, write, write, write, writeToFileequals, getClass, hashCode, notify, notifyAll, wait, wait, waitepsilonEquals, equals, frobeniusNormSquared, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getRow, getSize, getSubMatrix, isFixedSize, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setSize, toString, toString, write, write, writepublic static final SymmetricMatrix3d IDENTITY
public static final SymmetricMatrix3d ZERO
public SymmetricMatrix3d()
public SymmetricMatrix3d(double[] vals)
(i,j) is stored at location
i*colSize()+j. Only the diagonal and upper off-diagonal
values are used; the lower off-diagonal elements are copied from the upper
off-diagonal elements.vals - array from which values are copiedpublic SymmetricMatrix3d(Matrix3dBase M)
M - matrix whose values are to be copied.public SymmetricMatrix3d(double m00,
double m11,
double m22,
double m01,
double m02,
double m12)
m00 - element (0,0)m11 - element (1,1)m22 - element (2,2)m01 - element (0,1)m02 - element (0,2)m12 - element (1,2)public void set(Matrix3dBase M)
set in class Matrix3dBaseM - matrix whose values are to be copied.public void set(double[] vals)
(i,j) is stored at location i*colSize()+j.
Only the diagonal and upper off-diaginal values are used; the lower
off-diagonal elements are copied from the upper off-diagonal elements.set in interface DenseMatrixset in class Matrix3dBasevals - array from which values are copiedpublic void set(double m00,
double m11,
double m22,
double m01,
double m02,
double m12)
m00 - element (0,0)m11 - element (1,1)m22 - element (2,2)m01 - element (0,1)m02 - element (0,2)m12 - element (1,2)public boolean invert()
invert in class Matrix3dBasepublic double fastInvert(Matrix3dBase M)
M - matrix to invertpublic boolean invert(Matrix3dBase M)
M - matrix to invertpublic void setSymmetric(Matrix3dBase M)
1/2 (M + M')
M - matrix to take symmetric part ofpublic void mulLeftAndTransposeRight(Matrix3dBase M)
M - matrix to multiply bypublic void mulTransposeLeftAndRight(Matrix3dBase M)
M - matrix to multiply bypublic void mulDiagTransposeRight(Matrix3dBase M, Vector3d diag)
M - left (and right) matrix to multiply diagonal bydiag - diagonal matrix values for Dpublic void mulTransposeLeft(Matrix3dBase M)
M - matrix to form product frompublic void mulTransposeRight(Matrix3dBase M)
M - matrix to form product frompublic void mulSymmetric(Matrix3dBase A, Matrix3dBase B)
A - left matrixB - right matrixpublic void mulTransposeLeftSymmetric(Matrix3dBase A, Matrix3dBase B)
A - left matrixB - right matrixpublic void mulTransposeRightSymmetric(Matrix3dBase A, Matrix3dBase B)
A - left matrixB - right matrixpublic void add(SymmetricMatrix3d M1, SymmetricMatrix3d M2)
M1 - left-hand matrixM2 - right-hand matrixpublic void add(SymmetricMatrix3d M1)
M1 - right-hand matrixpublic void sub(SymmetricMatrix3d M1, SymmetricMatrix3d M2)
M1 - left-hand matrixM2 - right-hand matrixpublic void sub(SymmetricMatrix3d M1)
M1 - right-hand matrixpublic void scale(double s)
s.s - scaling factorpublic void scale(double s,
SymmetricMatrix3d M1)
s and places the
results in this matrix.s - scaling factorM1 - matrix to be scaledpublic void scaledAdd(double s,
SymmetricMatrix3d M1,
SymmetricMatrix3d M2)
s - scaling factorM1 - matrix to be scaledM2 - matrix to be addedpublic void scaledAdd(double s,
SymmetricMatrix3d M1)
s - scaling factorM1 - matrix to be scaled and addedpublic void dyad(Vector3d a)
a a^T.
a - dyad vectorpublic void addDyad(Vector3d a)
a a^Tto this matrix.
a - dyad vectorpublic void addScaledDyad(double s,
Vector3d a)
s a a^Tto this matrix.
s - scaling factora - dyad vectorpublic void symmetricDyad(Vector3d a, Vector3d b)
a b^T + b^T a.
a - first dyad vectorb - second dyad vectorpublic void addSymmetricDyad(Vector3d a, Vector3d b)
a b^T + b^T ato this matrix.
a - first dyad vectorb - second dyad vectorpublic void addScaledSymmetricDyad(double s,
Vector3d a,
Vector3d b)
s (a b^T + b^T a)to this matrix.
s - scaling factora - first dyad vectorb - second dyad vectorpublic void negate(SymmetricMatrix3d M1)
M1 - matrix to negatepublic void deviator(SymmetricMatrix3d M)
M - trace(M)/3 I
M - matrix to compute the deviator forpublic void deviator()
deviator(SymmetricMatrix3d)public void setZero()
public void setRandom()
public void setRandom(double lower,
double upper)
lower - lower random value (inclusive)upper - upper random value (exclusive)public void setRandom(double lower,
double upper,
java.util.Random generator)
lower - lower random value (inclusive)upper - upper random value (exclusive)generator - random number generatorpublic void setDiagonal(Vector3d diag)
diag - diagonal valuespublic void setDiagonal(double[] vals)
vals - diagonal valuespublic void getEigenValues(double[] eig)
public void getEigenValues(Vector3d eig)
getEigenValues.eig - resulting eigenvaluespublic void getEigenValues_old(Vector3d eig, Matrix3dBase V)
eig - resulting eigenvaluesV - corresponding eigenvectors (optional)public void getSVD(Matrix3dBase U, Vector3d sig, Matrix3dBase V)
javax.vecmath, though possibly at the expense
of some precision.U - if non-null, used to store the first orthogonal matrix in the
decomposition.sig - required parameter, used to store the 3 singular values of the matrix,
sorted from largest to smallest.V - if non-null, used to store the second orthogonal matrix in the
decomposition (note that the returned value is V and not V').public void getEigenValues(Vector3d eig, Matrix3dBase U)
public void getCholesky(Matrix3d L)
L - returns the lower triangular part of the decompositionjava.lang.IllegalArgumentException - if the matrix is not positive definite.