20#ifndef ROOT_Math_CramerInversionSym_icc
21#define ROOT_Math_CramerInversionSym_icc
24#error "Do not use CramerInversionSym.icc directly. #include \"Math/Dinv.h\" instead."
49 const Scalar c00 = rhs[4] * rhs[8] - rhs[5] * rhs[5];
50 const Scalar c01 = rhs[5] * rhs[2] - rhs[1] * rhs[8];
51 const Scalar c02 = rhs[1] * rhs[5] - rhs[4] * rhs[2];
52 const Scalar c11 = rhs[8] * rhs[0] - rhs[2] * rhs[2];
53 const Scalar c12 = rhs[2] * rhs[1] - rhs[5] * rhs[0];
54 const Scalar c22 = rhs[0] * rhs[4] - rhs[1] * rhs[1];
56 const Scalar t0 = std::abs(rhs[0]);
58 const Scalar t2 = std::abs(rhs[2]);
66 det = c12*c01-c11*c02;
69 det = c11*c22-c12*c12;
71 }
else if (t2 >=
t1) {
73 det = c12*c01-c11*c02;
76 det = c02*c12-c01*c22;
79 if ( det == 0 || tmp == 0)
152 const Scalar mDet3_012_012 = rhs[
SF00]*mDet2_12_12 - rhs[
SF01]*mDet2_12_02
153 + rhs[
SF02]*mDet2_12_01;
154 const Scalar mDet3_013_012 = rhs[
SF00]*mDet2_13_12 - rhs[
SF01]*mDet2_13_02
155 + rhs[
SF02]*mDet2_13_01;
156 const Scalar mDet3_013_013 = rhs[
SF00]*mDet2_13_13 - rhs[
SF01]*mDet2_13_03
157 + rhs[
SF03]*mDet2_13_01;
158 const Scalar mDet3_023_012 = rhs[
SF00]*mDet2_23_12 - rhs[
SF01]*mDet2_23_02
159 + rhs[
SF02]*mDet2_23_01;
160 const Scalar mDet3_023_013 = rhs[
SF00]*mDet2_23_13 - rhs[
SF01]*mDet2_23_03
161 + rhs[
SF03]*mDet2_23_01;
162 const Scalar mDet3_023_023 = rhs[
SF00]*mDet2_23_23 - rhs[
SF02]*mDet2_23_03
163 + rhs[
SF03]*mDet2_23_02;
164 const Scalar mDet3_123_012 = rhs[
SF10]*mDet2_23_12 - rhs[
SF11]*mDet2_23_02
165 + rhs[
SF12]*mDet2_23_01;
166 const Scalar mDet3_123_013 = rhs[
SF10]*mDet2_23_13 - rhs[
SF11]*mDet2_23_03
167 + rhs[
SF13]*mDet2_23_01;
168 const Scalar mDet3_123_023 = rhs[
SF10]*mDet2_23_23 - rhs[
SF12]*mDet2_23_03
169 + rhs[
SF13]*mDet2_23_02;
170 const Scalar mDet3_123_123 = rhs[
SF11]*mDet2_23_23 - rhs[
SF12]*mDet2_23_13
171 + rhs[
SF13]*mDet2_23_12;
175 const Scalar det = rhs[
SF00]*mDet3_123_123 - rhs[
SF01]*mDet3_123_023
176 + rhs[
SF02]*mDet3_123_013 - rhs[
SF03]*mDet3_123_012;
184 const Scalar oneOverDet = 1.0f / det;
185 const Scalar mn1OverDet = - oneOverDet;
187 rhs[
SF00] = mDet3_123_123 * oneOverDet;
188 rhs[
SF01] = mDet3_123_023 * mn1OverDet;
189 rhs[
SF02] = mDet3_123_013 * oneOverDet;
190 rhs[
SF03] = mDet3_123_012 * mn1OverDet;
192 rhs[
SF11] = mDet3_023_023 * oneOverDet;
193 rhs[
SF12] = mDet3_023_013 * mn1OverDet;
194 rhs[
SF13] = mDet3_023_012 * oneOverDet;
196 rhs[
SF22] = mDet3_013_013 * oneOverDet;
197 rhs[
SF23] = mDet3_013_012 * mn1OverDet;
199 rhs[
SF33] = mDet3_012_012 * oneOverDet;
279 const Scalar mDet3_123_012 = rhs[
SM10]*mDet2_23_12 - rhs[
SM11]*mDet2_23_02 + rhs[
SM12]*mDet2_23_01;
280 const Scalar mDet3_123_013 = rhs[
SM10]*mDet2_23_13 - rhs[
SM11]*mDet2_23_03 + rhs[
SM13]*mDet2_23_01;
281 const Scalar mDet3_123_023 = rhs[
SM10]*mDet2_23_23 - rhs[
SM12]*mDet2_23_03 + rhs[
SM13]*mDet2_23_02;
282 const Scalar mDet3_123_123 = rhs[
SM11]*mDet2_23_23 - rhs[
SM12]*mDet2_23_13 + rhs[
SM13]*mDet2_23_12;
283 const Scalar mDet3_124_012 = rhs[
SM10]*mDet2_24_12 - rhs[
SM11]*mDet2_24_02 + rhs[
SM12]*mDet2_24_01;
284 const Scalar mDet3_124_013 = rhs[
SM10]*mDet2_24_13 - rhs[
SM11]*mDet2_24_03 + rhs[
SM13]*mDet2_24_01;
285 const Scalar mDet3_124_014 = rhs[
SM10]*mDet2_24_14 - rhs[
SM11]*mDet2_24_04 + rhs[
SM14]*mDet2_24_01;
286 const Scalar mDet3_124_023 = rhs[
SM10]*mDet2_24_23 - rhs[
SM12]*mDet2_24_03 + rhs[
SM13]*mDet2_24_02;
287 const Scalar mDet3_124_024 = rhs[
SM10]*mDet2_24_24 - rhs[
SM12]*mDet2_24_04 + rhs[
SM14]*mDet2_24_02;
288 const Scalar mDet3_124_123 = rhs[
SM11]*mDet2_24_23 - rhs[
SM12]*mDet2_24_13 + rhs[
SM13]*mDet2_24_12;
289 const Scalar mDet3_124_124 = rhs[
SM11]*mDet2_24_24 - rhs[
SM12]*mDet2_24_14 + rhs[
SM14]*mDet2_24_12;
290 const Scalar mDet3_134_012 = rhs[
SM10]*mDet2_34_12 - rhs[
SM11]*mDet2_34_02 + rhs[
SM12]*mDet2_34_01;
291 const Scalar mDet3_134_013 = rhs[
SM10]*mDet2_34_13 - rhs[
SM11]*mDet2_34_03 + rhs[
SM13]*mDet2_34_01;
292 const Scalar mDet3_134_014 = rhs[
SM10]*mDet2_34_14 - rhs[
SM11]*mDet2_34_04 + rhs[
SM14]*mDet2_34_01;
293 const Scalar mDet3_134_023 = rhs[
SM10]*mDet2_34_23 - rhs[
SM12]*mDet2_34_03 + rhs[
SM13]*mDet2_34_02;
294 const Scalar mDet3_134_024 = rhs[
SM10]*mDet2_34_24 - rhs[
SM12]*mDet2_34_04 + rhs[
SM14]*mDet2_34_02;
295 const Scalar mDet3_134_034 = rhs[
SM10]*mDet2_34_34 - rhs[
SM13]*mDet2_34_04 + rhs[
SM14]*mDet2_34_03;
296 const Scalar mDet3_134_123 = rhs[
SM11]*mDet2_34_23 - rhs[
SM12]*mDet2_34_13 + rhs[
SM13]*mDet2_34_12;
297 const Scalar mDet3_134_124 = rhs[
SM11]*mDet2_34_24 - rhs[
SM12]*mDet2_34_14 + rhs[
SM14]*mDet2_34_12;
298 const Scalar mDet3_134_134 = rhs[
SM11]*mDet2_34_34 - rhs[
SM13]*mDet2_34_14 + rhs[
SM14]*mDet2_34_13;
299 const Scalar mDet3_234_012 = rhs[
SM20]*mDet2_34_12 - rhs[
SM21]*mDet2_34_02 + rhs[
SM22]*mDet2_34_01;
300 const Scalar mDet3_234_013 = rhs[
SM20]*mDet2_34_13 - rhs[
SM21]*mDet2_34_03 + rhs[
SM23]*mDet2_34_01;
301 const Scalar mDet3_234_014 = rhs[
SM20]*mDet2_34_14 - rhs[
SM21]*mDet2_34_04 + rhs[
SM24]*mDet2_34_01;
302 const Scalar mDet3_234_023 = rhs[
SM20]*mDet2_34_23 - rhs[
SM22]*mDet2_34_03 + rhs[
SM23]*mDet2_34_02;
303 const Scalar mDet3_234_024 = rhs[
SM20]*mDet2_34_24 - rhs[
SM22]*mDet2_34_04 + rhs[
SM24]*mDet2_34_02;
304 const Scalar mDet3_234_034 = rhs[
SM20]*mDet2_34_34 - rhs[
SM23]*mDet2_34_04 + rhs[
SM24]*mDet2_34_03;
305 const Scalar mDet3_234_123 = rhs[
SM21]*mDet2_34_23 - rhs[
SM22]*mDet2_34_13 + rhs[
SM23]*mDet2_34_12;
306 const Scalar mDet3_234_124 = rhs[
SM21]*mDet2_34_24 - rhs[
SM22]*mDet2_34_14 + rhs[
SM24]*mDet2_34_12;
307 const Scalar mDet3_234_134 = rhs[
SM21]*mDet2_34_34 - rhs[
SM23]*mDet2_34_14 + rhs[
SM24]*mDet2_34_13;
308 const Scalar mDet3_234_234 = rhs[
SM22]*mDet2_34_34 - rhs[
SM23]*mDet2_34_24 + rhs[
SM24]*mDet2_34_23;
312 const Scalar mDet4_0123_0123 = rhs[
SM00]*mDet3_123_123 - rhs[
SM01]*mDet3_123_023
313 + rhs[
SM02]*mDet3_123_013 - rhs[
SM03]*mDet3_123_012;
314 const Scalar mDet4_0124_0123 = rhs[
SM00]*mDet3_124_123 - rhs[
SM01]*mDet3_124_023
315 + rhs[
SM02]*mDet3_124_013 - rhs[
SM03]*mDet3_124_012;
316 const Scalar mDet4_0124_0124 = rhs[
SM00]*mDet3_124_124 - rhs[
SM01]*mDet3_124_024
317 + rhs[
SM02]*mDet3_124_014 - rhs[
SM04]*mDet3_124_012;
318 const Scalar mDet4_0134_0123 = rhs[
SM00]*mDet3_134_123 - rhs[
SM01]*mDet3_134_023
319 + rhs[
SM02]*mDet3_134_013 - rhs[
SM03]*mDet3_134_012;
320 const Scalar mDet4_0134_0124 = rhs[
SM00]*mDet3_134_124 - rhs[
SM01]*mDet3_134_024
321 + rhs[
SM02]*mDet3_134_014 - rhs[
SM04]*mDet3_134_012;
322 const Scalar mDet4_0134_0134 = rhs[
SM00]*mDet3_134_134 - rhs[
SM01]*mDet3_134_034
323 + rhs[
SM03]*mDet3_134_014 - rhs[
SM04]*mDet3_134_013;
324 const Scalar mDet4_0234_0123 = rhs[
SM00]*mDet3_234_123 - rhs[
SM01]*mDet3_234_023
325 + rhs[
SM02]*mDet3_234_013 - rhs[
SM03]*mDet3_234_012;
326 const Scalar mDet4_0234_0124 = rhs[
SM00]*mDet3_234_124 - rhs[
SM01]*mDet3_234_024
327 + rhs[
SM02]*mDet3_234_014 - rhs[
SM04]*mDet3_234_012;
328 const Scalar mDet4_0234_0134 = rhs[
SM00]*mDet3_234_134 - rhs[
SM01]*mDet3_234_034
329 + rhs[
SM03]*mDet3_234_014 - rhs[
SM04]*mDet3_234_013;
330 const Scalar mDet4_0234_0234 = rhs[
SM00]*mDet3_234_234 - rhs[
SM02]*mDet3_234_034
331 + rhs[
SM03]*mDet3_234_024 - rhs[
SM04]*mDet3_234_023;
332 const Scalar mDet4_1234_0123 = rhs[
SM10]*mDet3_234_123 - rhs[
SM11]*mDet3_234_023
333 + rhs[
SM12]*mDet3_234_013 - rhs[
SM13]*mDet3_234_012;
334 const Scalar mDet4_1234_0124 = rhs[
SM10]*mDet3_234_124 - rhs[
SM11]*mDet3_234_024
335 + rhs[
SM12]*mDet3_234_014 - rhs[
SM14]*mDet3_234_012;
336 const Scalar mDet4_1234_0134 = rhs[
SM10]*mDet3_234_134 - rhs[
SM11]*mDet3_234_034
337 + rhs[
SM13]*mDet3_234_014 - rhs[
SM14]*mDet3_234_013;
338 const Scalar mDet4_1234_0234 = rhs[
SM10]*mDet3_234_234 - rhs[
SM12]*mDet3_234_034
339 + rhs[
SM13]*mDet3_234_024 - rhs[
SM14]*mDet3_234_023;
340 const Scalar mDet4_1234_1234 = rhs[
SM11]*mDet3_234_234 - rhs[
SM12]*mDet3_234_134
341 + rhs[
SM13]*mDet3_234_124 - rhs[
SM14]*mDet3_234_123;
345 const Scalar det = rhs[
SM00]*mDet4_1234_1234 - rhs[
SM01]*mDet4_1234_0234 + rhs[
SM02]*mDet4_1234_0134
346 - rhs[
SM03]*mDet4_1234_0124 + rhs[
SM04]*mDet4_1234_0123;
353 const Scalar oneOverDet = 1.0f / det;
354 const Scalar mn1OverDet = - oneOverDet;
356 rhs[
SM00] = mDet4_1234_1234 * oneOverDet;
357 rhs[
SM01] = mDet4_1234_0234 * mn1OverDet;
358 rhs[
SM02] = mDet4_1234_0134 * oneOverDet;
359 rhs[
SM03] = mDet4_1234_0124 * mn1OverDet;
360 rhs[
SM04] = mDet4_1234_0123 * oneOverDet;
362 rhs[
SM11] = mDet4_0234_0234 * oneOverDet;
363 rhs[
SM12] = mDet4_0234_0134 * mn1OverDet;
364 rhs[
SM13] = mDet4_0234_0124 * oneOverDet;
365 rhs[
SM14] = mDet4_0234_0123 * mn1OverDet;
367 rhs[
SM22] = mDet4_0134_0134 * oneOverDet;
368 rhs[
SM23] = mDet4_0134_0124 * mn1OverDet;
369 rhs[
SM24] = mDet4_0134_0123 * oneOverDet;
371 rhs[
SM33] = mDet4_0124_0124 * oneOverDet;
372 rhs[
SM34] = mDet4_0124_0123 * mn1OverDet;
374 rhs[
SM44] = mDet4_0123_0123 * oneOverDet;
static bool Dinv(MatrixRep &rhs)
MatRepSym Matrix storage representation for a symmetric matrix of dimension NxN This class is a templ...
Namespace for new Math classes and functions.
Rotation3D::Scalar Scalar
static constexpr double s