2 x 2 symmetric matrix
More...
#include <JMatrix2S.hh>
2 x 2 symmetric matrix
Definition at line 26 of file JMatrix2S.hh.
◆ JMatrix2S() [1/3]
JMATH::JMatrix2S::JMatrix2S |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 33 of file JMatrix2S.hh.
33 :
35 {}
JMatrix2D()
Default constructor.
◆ JMatrix2S() [2/3]
JMATH::JMatrix2S::JMatrix2S |
( |
const JMatrix2D & | A | ) |
|
|
inline |
◆ JMatrix2S() [3/3]
JMATH::JMatrix2S::JMatrix2S |
( |
const double | __a00, |
|
|
const double | __a10, |
|
|
const double | __a11 ) |
|
inline |
Contructor.
The upper triangle is internally set.
- Parameters
-
__a00 | (0,0) |
__a10 | (1,0) |
__a11 | (1,1) |
Definition at line 56 of file JMatrix2S.hh.
57 :
59 __a10, __a11)
60 {}
◆ invert()
void JMATH::JMatrix2S::invert |
( |
| ) |
|
|
inline |
Invert matrix.
Definition at line 66 of file JMatrix2S.hh.
67 {
68 using std::swap;
69
70
71
72 int p0 = 0;
73
74 double val;
75
77
78 if (fabs(
a10) > fabs(val)) {
79
80 p0 = 1;
82
85 }
86
87 if (val == 0) {
88 throw JDivisionByZero("LDU decomposition zero pivot");
89 }
90
93
94
95
97 throw JDivisionByZero("D matrix not invertable");
98 }
99
102
103
104
107
108
109
111
112
113
116
117 switch (p0) {
118
119 case 1:
122 break;
123 }
124 }
◆ getInstance()
static const JMatrix2D & JMATH::JMatrix2D::getInstance |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- zero matrix
Definition at line 70 of file JMath/JMatrix2D.hh.
71 {
73
74 return matrix;
75 }
◆ setIdentity()
JMatrix2D & JMATH::JMatrix2D::setIdentity |
( |
| ) |
|
|
inlineinherited |
Set to identity matrix.
- Returns
- this matrix
Definition at line 83 of file JMath/JMatrix2D.hh.
84 {
87
88 return *this;
89 }
◆ getIdentity()
static const JMatrix2D & JMATH::JMatrix2D::getIdentity |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- identity matrix
Definition at line 97 of file JMath/JMatrix2D.hh.
98 {
100
101 return matrix;
102 }
JMatrix2D & setIdentity()
Set to identity matrix.
◆ set()
void JMATH::JMatrix2D::set |
( |
const JMatrix2D & | A | ) |
|
|
inlineinherited |
◆ reset()
Set matrix to the null matrix.
- Returns
- this matrix
Definition at line 121 of file JMath/JMatrix2D.hh.
122 {
124
125 return *this;
126 }
◆ transpose()
Transpose.
- Returns
- this matrix
Definition at line 134 of file JMath/JMatrix2D.hh.
135 {
136 using std::swap;
137
139
140 return *this;
141 }
◆ negate()
Negate matrix.
- Returns
- -this matrix
Definition at line 149 of file JMath/JMatrix2D.hh.
150 {
153
154 return *this;
155 }
◆ add()
Matrix addition.
- Parameters
-
- Returns
- this matrix + A
Definition at line 164 of file JMath/JMatrix2D.hh.
165 {
166 a00 += A.a00;
a01 += A.a01;
167 a10 += A.a10;
a11 += A.a11;
168
169 return *this;
170 }
◆ sub()
Matrix subtraction.
- Parameters
-
- Returns
- this matrix - A
Definition at line 179 of file JMath/JMatrix2D.hh.
180 {
181 a00 -= A.a00;
a01 -= A.a01;
182 a10 -= A.a10;
a11 -= A.a11;
183
184 return *this;
185 }
◆ mul() [1/3]
JMatrix2D & JMATH::JMatrix2D::mul |
( |
const double | factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix * factor
Definition at line 194 of file JMath/JMatrix2D.hh.
195 {
196 a00 *= factor;
a01 *= factor;
197 a10 *= factor;
a11 *= factor;
198
199 return *this;
200 }
◆ mul() [2/3]
Matrix multiplication.
- Parameters
-
- Returns
- this matrix
Definition at line 225 of file JMath/JMatrix2D.hh.
227 {
228 a00 = A.a00 * B.a00 + A.a01 * B.a10;
229 a01 = A.a00 * B.a01 + A.a01 * B.a11;
230
231 a10 = A.a10 * B.a00 + A.a11 * B.a10;
232 a11 = A.a10 * B.a01 + A.a11 * B.a11;
233
234 return *this;
235 }
◆ mul() [3/3]
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }
◆ div()
JMatrix2D & JMATH::JMatrix2D::div |
( |
const double | factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix / factor
Definition at line 209 of file JMath/JMatrix2D.hh.
210 {
211 a00 /= factor;
a01 /= factor;
212 a10 /= factor;
a11 /= factor;
213
214 return *this;
215 }
◆ equals()
bool JMATH::JMatrix2D::equals |
( |
const JMatrix2D & | 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 245 of file JMath/JMatrix2D.hh.
247 {
248 return (fabs(
a00 - A.a00) <= eps &&
249 fabs(
a01 - A.a01) <= eps &&
250 fabs(
a10 - A.a10) <= eps &&
251 fabs(
a11 - A.a11) <= eps);
252 }
◆ isIdentity()
bool JMATH::JMatrix2D::isIdentity |
( |
const double | eps = std::numeric_limits<double>::min() | ) |
const |
|
inlineinherited |
Test identity.
- Parameters
-
- Returns
- true if identity matrix; else false
Definition at line 261 of file JMath/JMatrix2D.hh.
262 {
264 }
static const JMatrix2D & getIdentity()
Get reference to unique instance of this class object.
bool equals(const JMatrix2D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
◆ getDeterminant()
double JMATH::JMatrix2D::getDeterminant |
( |
| ) |
const |
|
inlineinherited |
Get determinant of matrix.
- Returns
- determinant of matrix
Definition at line 272 of file JMath/JMatrix2D.hh.
◆ transform()
void JMATH::JMatrix2D::transform |
( |
double & | __x, |
|
|
double & | __y ) const |
|
inlineinherited |
Transform.
- Parameters
-
Definition at line 284 of file JMath/JMatrix2D.hh.
285 {
286 const double x =
a00 * __x +
a01 * __y;
287 const double y =
a10 * __x +
a11 * __y;
288
291 }
◆ a00
double JMATH::JMatrix2D::a00 |
|
inherited |
◆ a01
double JMATH::JMatrix2D::a01 |
|
inherited |
◆ a10
double JMATH::JMatrix2D::a10 |
|
inherited |
◆ a11
double JMATH::JMatrix2D::a11 |
|
inherited |
The documentation for this class was generated from the following file: