|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.MatrixBase
maspack.matrix.DenseMatrixBase
maspack.matrix.Matrix3dBase
maspack.matrix.SymmetricMatrix3d
public class SymmetricMatrix3d
A symmetric 3 x 3 matrix with the elements stored as explicit fields.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface maspack.matrix.Matrix |
---|
Matrix.Partition, Matrix.WriteFormat |
Field Summary | |
---|---|
static SymmetricMatrix3d |
IDENTITY
Global identity matrix. |
static SymmetricMatrix3d |
ZERO
Global zero matrix. |
Fields inherited from class maspack.matrix.Matrix3dBase |
---|
m00, m01, m02, m10, m11, m12, m20, m21, m22 |
Fields inherited from interface maspack.matrix.Matrix |
---|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 |
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. |
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 |
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 |
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 |
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 |
Methods inherited from class maspack.matrix.Matrix3dBase |
---|
clone, colSize, determinant, epsilonEquals, equals, factorQR, frobeniusNorm, get, get, getColumn, getColumn, getColumn, getRow, getRow, getRow, infinityNorm, inverseTransform, invert, isIdentity, main, mul, mul, mul, mulAdd, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, mulTransposeAdd, negate, oneNorm, orthogonalDeterminant, rowSize, set, set, setColumn, setColumn, setIdentity, setRow, setRow, trace, transpose |
Methods inherited from class maspack.matrix.DenseMatrixBase |
---|
add, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrix |
Methods inherited from class maspack.matrix.MatrixBase |
---|
containsNaN, epsilonEquals, equals, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, isFixedSize, isSymmetric, 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, writeToFile |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface maspack.matrix.Matrix |
---|
epsilonEquals, equals, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getRow, getSize, getSubMatrix, isFixedSize, isSymmetric, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setSize, toString, write, write, write |
Field Detail |
---|
public static final SymmetricMatrix3d IDENTITY
public static final SymmetricMatrix3d ZERO
Constructor Detail |
---|
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)Method Detail |
---|
public void set(Matrix3dBase M)
set
in class Matrix3dBase
M
- 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 DenseMatrix
set
in class Matrix3dBase
vals
- 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 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 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 decomposition
java.lang.IllegalArgumentException
- if the matrix is not positive definite.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |