3 x 3 symmetric matrix
More...
#include <JMatrix3S.hh>
3 x 3 symmetric matrix
Definition at line 29 of file JMatrix3S.hh.
◆ eigen_values
Type definition of Eigen values.
Definition at line 36 of file JMatrix3S.hh.
◆ JMatrix3S() [1/3]
JMATH::JMatrix3S::JMatrix3S |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 42 of file JMatrix3S.hh.
JMatrix3D()
Default constructor.
◆ JMatrix3S() [2/3]
JMATH::JMatrix3S::JMatrix3S |
( |
const JMatrix3D & |
A | ) |
|
|
inline |
◆ JMatrix3S() [3/3]
JMATH::JMatrix3S::JMatrix3S |
( |
const double |
__a00, |
|
|
const double |
__a10, |
|
|
const double |
__a11, |
|
|
const double |
__a20, |
|
|
const double |
__a21, |
|
|
const double |
__a22 |
|
) |
| |
|
inline |
Contructor.
The upper triangle is internally set.
- Parameters
-
__a00 | (0,0) |
__a10 | (1,0) |
__a11 | (1,1) |
__a20 | (2,0) |
__a21 | (2,1) |
__a22 | (2,2) |
Definition at line 68 of file JMatrix3S.hh.
◆ invert()
void JMATH::JMatrix3S::invert |
( |
| ) |
|
|
inline |
Invert matrix.
Definition at line 80 of file JMatrix3S.hh.
93 if (fabs(
a10) > fabs(val)) {
98 if (fabs(
a20) > fabs(val)) {
119 throw JDivisionByZero(
"LDU decomposition zero pivot");
132 if (fabs(
a21) > fabs(val)) {
147 throw JDivisionByZero(
"LDU decomposition zero pivot");
156 throw JDivisionByZero(
"D matrix not invertable");
◆ getEigenValues()
eigen_values JMATH::JMatrix3S::getEigenValues |
( |
const double |
epsilon = 1e-6 | ) |
const |
|
inline |
Get eigen values.
The eigen values sorted in decreasing order of absolute values.
Algorithm taken from "Eigenvalues of a symmetric 3x3 matrix"
by Oliver K. Smith; see reference.
- Parameters
-
- Returns
- eigen values
Definition at line 227 of file JMatrix3S.hh.
237 const double q = (
a00 +
a11 +
a22) / 3.0;
239 const double p = sqrt(p2 / 6.0);
246 const double r = B.getDeterminant() / 2.0;
247 const double phi = (
r < -1.0 ?
PI / 3.0 : (
r > 1.0 ? 0.0 : acos(
r) / 3.0));
249 eigenvalues[0] = q + 2*p*cos(phi);
250 eigenvalues[2] = q + 2*p*cos(phi + 2*
PI/3.0);
251 eigenvalues[1] = 3 * q - eigenvalues[0] - eigenvalues[2];
260 if (fabs(eigenvalues[0]) < fabs(eigenvalues[1])) {
261 swap(eigenvalues[0], eigenvalues[1]);
264 if (fabs(eigenvalues[1]) < fabs(eigenvalues[2])) {
266 swap(eigenvalues[1], eigenvalues[2]);
268 if (fabs(eigenvalues[0]) < fabs(eigenvalues[1])) {
269 swap(eigenvalues[0], eigenvalues[1]);
static const JMatrix3D & getIdentity()
Get reference to unique instance of this class object.
std::array< double, 3 > eigen_values
Type definition of Eigen values.
static const double PI
Mathematical constants.
◆ getInstance()
static const JMatrix3D& JMATH::JMatrix3D::getInstance |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- zero matrix
Definition at line 78 of file JMath/JMatrix3D.hh.
◆ setIdentity()
◆ getIdentity()
static const JMatrix3D& JMATH::JMatrix3D::getIdentity |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- identity matrix
Definition at line 106 of file JMath/JMatrix3D.hh.
JMatrix3D & setIdentity()
Set to identity matrix.
◆ set()
void JMATH::JMatrix3D::set |
( |
const JMatrix3D & |
A | ) |
|
|
inlineinherited |
◆ reset()
◆ transpose()
◆ negate()
◆ add()
◆ sub()
◆ mul() [1/3]
JMatrix3D& JMATH::JMatrix3D::mul |
( |
const double |
factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix * factor
Definition at line 208 of file JMath/JMatrix3D.hh.
210 a00 *= factor;
a01 *= factor;
a02 *= factor;
211 a10 *= factor;
a11 *= factor;
a12 *= factor;
212 a20 *= factor;
a21 *= factor;
a22 *= factor;
◆ mul() [2/3]
◆ mul() [3/3]
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
◆ div()
JMatrix3D& JMATH::JMatrix3D::div |
( |
const double |
factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix / factor
Definition at line 224 of file JMath/JMatrix3D.hh.
226 a00 /= factor;
a01 /= factor;
a02 /= factor;
227 a10 /= factor;
a11 /= factor;
a12 /= factor;
228 a20 /= factor;
a21 /= factor;
a22 /= factor;
◆ equals()
bool JMATH::JMatrix3D::equals |
( |
const JMatrix3D & |
A, |
|
|
const double |
eps = std::numeric_limits<double>::min() |
|
) |
| const |
|
inlineinherited |
Equality.
- Parameters
-
A | matrix |
eps | numerical precision |
- Returns
- true if matrices identical; else false
Definition at line 267 of file JMath/JMatrix3D.hh.
270 return (fabs(
a00 - A.
a00) <= eps &&
271 fabs(
a01 - A.
a01) <= eps &&
272 fabs(
a02 - A.
a02) <= eps &&
273 fabs(
a10 - A.
a10) <= eps &&
274 fabs(
a11 - A.
a11) <= eps &&
275 fabs(
a12 - A.
a12) <= eps &&
276 fabs(
a20 - A.
a20) <= eps &&
277 fabs(
a21 - A.
a21) <= eps &&
278 fabs(
a22 - A.
a22) <= eps);
◆ isIdentity()
bool JMATH::JMatrix3D::isIdentity |
( |
const double |
eps = std::numeric_limits<double>::min() | ) |
const |
|
inlineinherited |
Test identity.
- Parameters
-
- Returns
- true if identity matrix; else false
Definition at line 288 of file JMath/JMatrix3D.hh.
bool equals(const JMatrix3D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
◆ getDeterminant()
double JMATH::JMatrix3D::getDeterminant |
( |
| ) |
const |
|
inlineinherited |
Get determinant of matrix.
- Returns
- determinant of matrix
Definition at line 299 of file JMath/JMatrix3D.hh.
◆ transform()
void JMATH::JMatrix3D::transform |
( |
double & |
__x, |
|
|
double & |
__y, |
|
|
double & |
__z |
|
) |
| const |
|
inlineinherited |
Transform.
- Parameters
-
__x | x value |
__y | y value |
__z | z value |
Definition at line 318 of file JMath/JMatrix3D.hh.
320 const double x =
a00 * __x +
a01 * __y +
a02 * __z;
321 const double y =
a10 * __x +
a11 * __y +
a12 * __z;
322 const double z =
a20 * __x +
a21 * __y +
a22 * __z;
◆ a00
double JMATH::JMatrix3D::a00 |
|
inherited |
◆ a01
double JMATH::JMatrix3D::a01 |
|
inherited |
◆ a02
double JMATH::JMatrix3D::a02 |
|
inherited |
◆ a10
double JMATH::JMatrix3D::a10 |
|
inherited |
◆ a11
double JMATH::JMatrix3D::a11 |
|
inherited |
◆ a12
double JMATH::JMatrix3D::a12 |
|
inherited |
◆ a20
double JMATH::JMatrix3D::a20 |
|
inherited |
◆ a21
double JMATH::JMatrix3D::a21 |
|
inherited |
◆ a22
double JMATH::JMatrix3D::a22 |
|
inherited |
The documentation for this class was generated from the following file: