|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.MatrixObject
maspack.matrix.Matrix3dObject
maspack.matrix.SymmetricMatrix3d
A symmetric 3 x 3 matrix with the elements stored as explicit fields.
Field Summary |
Fields inherited from class maspack.matrix.Matrix3dObject |
m00, m01, m02, m10, m11, m12, m20, m21, m22 |
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(Matrix3dObject 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 |
getCholesky(Matrix3d L)
Computes the Cholesky decomposition of this matrix, which is assumed to be positive definite. |
void |
getEigenValues(double[] eig)
|
void |
getEigenValues(Vector3d eig)
Quickly computes the eigenvalues of this symmetric matrix. |
void |
getSVD(Matrix3dObject U,
Vector3d sig,
Matrix3dObject V)
Quickly computes the singular value decomposition U S V' of this symmetric matrix. |
void |
mulLeftAndTransposeRight(Matrix3dObject 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(Matrix3dObject 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(Matrix3dObject 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 |
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 |
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(Matrix3dObject 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 |
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. |
Methods inherited from class maspack.matrix.Matrix3dObject |
colSize, determinant, epsilonEquals, equals, frobeniusNorm, get, get, getColumn, getColumn, getRow, getRow, infinityNorm, invert, mul, mul, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, negate, oneNorm, rowSize, set, setColumn, setColumn, setIdentity, setRow, setRow, transpose |
Methods inherited from class maspack.matrix.MatrixObject |
epsilonEquals, equals, equals, get, getColumn, getRow, isFixedSize, scan, set, set, setColumn, setRow, setSize, toString, toString, toString |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
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(Matrix3dObject 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(Matrix3dObject M)
set
in class Matrix3dObject
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 class Matrix3dObject
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 mulLeftAndTransposeRight(Matrix3dObject M)
M
- matrix to multiply bypublic void mulTransposeLeftAndRight(Matrix3dObject M)
M
- matrix to multiply bypublic void mulTransposeLeft(Matrix3dObject 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 negate(SymmetricMatrix3d M1)
M1
- matrix to negatepublic 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)
eig
- Resulting eigenvaluespublic void getSVD(Matrix3dObject U, Vector3d sig, Matrix3dObject 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 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 |