ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TMatrixTCramerInv.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Authors: Fons Rademakers, Eddy Offermann Jan 2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TMatrixTCramerInv //
15 // //
16 // Encapsulate templates of Cramer Inversion routines. //
17 // //
18 // The 4x4, 5x5 and 6x6 are adapted from routines written by //
19 // Mark Fischler and Steven Haywood as part of the CLHEP package //
20 // //
21 // Although for sizes <= 6x6 the Cramer Inversion has a gain in speed //
22 // compared to factorization schemes (like LU) , one pays a price in //
23 // accuracy . //
24 // //
25 // For Example: //
26 // H * H^-1 = U, where H is a 5x5 Hilbert matrix //
27 // U is a 5x5 Unity matrix //
28 // //
29 // LU : |U_jk| < 10e-13 for j!=k //
30 // Cramer: |U_jk| < 10e-7 for j!=k //
31 // //
32 // however Cramer algorithm is about 10 (!) times faster //
33 //////////////////////////////////////////////////////////////////////////
34 
35 #include "TMatrixTCramerInv.h"
36 
37 #if !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__FBSD)
38 NamespaceImp(TMatrixTCramerInv);
39 #endif
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 
43 template<class Element>
45 {
46  if (m.GetNrows() != 2 || m.GetNcols() != 2 || m.GetRowLwb() != m.GetColLwb()) {
47  Error("Inv2x2","matrix should be square 2x2");
48  return kFALSE;
49  }
50 
51  Element *pM = m.GetMatrixArray();
52 
53  const Double_t det = pM[0] * pM[3] - pM[2] * pM[1];
54 
55  if (determ)
56  *determ = det;
57 
58  const Double_t s = 1./det;
59  if ( det == 0 ) {
60  Error("Inv2x2","matrix is singular");
61  return kFALSE;
62  }
63 
64  const Double_t tmp = s*pM[3];
65  pM[1] *= -s;
66  pM[2] *= -s;
67  pM[3] = s*pM[0];
68  pM[0] = tmp;
69 
70  return kTRUE;
71 }
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 
75 template<class Element>
77 {
78  if (m.GetNrows() != 3 || m.GetNcols() != 3 || m.GetRowLwb() != m.GetColLwb()) {
79  Error("Inv3x3","matrix should be square 3x3");
80  return kFALSE;
81  }
82 
83  Element *pM = m.GetMatrixArray();
84 
85  const Double_t c00 = pM[4] * pM[8] - pM[5] * pM[7];
86  const Double_t c01 = pM[5] * pM[6] - pM[3] * pM[8];
87  const Double_t c02 = pM[3] * pM[7] - pM[4] * pM[6];
88  const Double_t c10 = pM[7] * pM[2] - pM[8] * pM[1];
89  const Double_t c11 = pM[8] * pM[0] - pM[6] * pM[2];
90  const Double_t c12 = pM[6] * pM[1] - pM[7] * pM[0];
91  const Double_t c20 = pM[1] * pM[5] - pM[2] * pM[4];
92  const Double_t c21 = pM[2] * pM[3] - pM[0] * pM[5];
93  const Double_t c22 = pM[0] * pM[4] - pM[1] * pM[3];
94 
95  const Double_t t0 = TMath::Abs(pM[0]);
96  const Double_t t1 = TMath::Abs(pM[3]);
97  const Double_t t2 = TMath::Abs(pM[6]);
98  Double_t det;
99  Double_t tmp;
100  if (t0 >= t1) {
101  if (t2 >= t0) {
102  tmp = pM[6];
103  det = c12*c01-c11*c02;
104  } else {
105  tmp = pM[0];
106  det = c11*c22-c12*c21;
107  }
108  } else if (t2 >= t1) {
109  tmp = pM[6];
110  det = c12*c01-c11*c02;
111  } else {
112  tmp = pM[3];
113  det = c02*c21-c01*c22;
114  }
115 
116  if ( det == 0 || tmp == 0) {
117  Error("Inv3x3","matrix is singular");
118  return kFALSE;
119  }
120 
121  const Double_t s = tmp/det;
122  if (determ)
123  *determ = 1./s;
124 
125  pM[0] = s*c00;
126  pM[1] = s*c10;
127  pM[2] = s*c20;
128  pM[3] = s*c01;
129  pM[4] = s*c11;
130  pM[5] = s*c21;
131  pM[6] = s*c02;
132  pM[7] = s*c12;
133  pM[8] = s*c22;
134 
135  return kTRUE;
136 }
137 
138 // GFij are indices for a 4x4 matrix.
139 
140 #define GF00 0
141 #define GF01 1
142 #define GF02 2
143 #define GF03 3
144 
145 #define GF10 4
146 #define GF11 5
147 #define GF12 6
148 #define GF13 7
149 
150 #define GF20 8
151 #define GF21 9
152 #define GF22 10
153 #define GF23 11
154 
155 #define GF30 12
156 #define GF31 13
157 #define GF32 14
158 #define GF33 15
159 
160 ////////////////////////////////////////////////////////////////////////////////
161 
162 template<class Element>
164 {
165  if (m.GetNrows() != 4 || m.GetNcols() != 4 || m.GetRowLwb() != m.GetColLwb()) {
166  Error("Inv4x4","matrix should be square 4x4");
167  return kFALSE;
168  }
169 
170  Element *pM = m.GetMatrixArray();
171 
172  // Find all NECESSARY 2x2 dets: (18 of them)
173 
174  const Double_t det2_12_01 = pM[GF10]*pM[GF21] - pM[GF11]*pM[GF20];
175  const Double_t det2_12_02 = pM[GF10]*pM[GF22] - pM[GF12]*pM[GF20];
176  const Double_t det2_12_03 = pM[GF10]*pM[GF23] - pM[GF13]*pM[GF20];
177  const Double_t det2_12_13 = pM[GF11]*pM[GF23] - pM[GF13]*pM[GF21];
178  const Double_t det2_12_23 = pM[GF12]*pM[GF23] - pM[GF13]*pM[GF22];
179  const Double_t det2_12_12 = pM[GF11]*pM[GF22] - pM[GF12]*pM[GF21];
180  const Double_t det2_13_01 = pM[GF10]*pM[GF31] - pM[GF11]*pM[GF30];
181  const Double_t det2_13_02 = pM[GF10]*pM[GF32] - pM[GF12]*pM[GF30];
182  const Double_t det2_13_03 = pM[GF10]*pM[GF33] - pM[GF13]*pM[GF30];
183  const Double_t det2_13_12 = pM[GF11]*pM[GF32] - pM[GF12]*pM[GF31];
184  const Double_t det2_13_13 = pM[GF11]*pM[GF33] - pM[GF13]*pM[GF31];
185  const Double_t det2_13_23 = pM[GF12]*pM[GF33] - pM[GF13]*pM[GF32];
186  const Double_t det2_23_01 = pM[GF20]*pM[GF31] - pM[GF21]*pM[GF30];
187  const Double_t det2_23_02 = pM[GF20]*pM[GF32] - pM[GF22]*pM[GF30];
188  const Double_t det2_23_03 = pM[GF20]*pM[GF33] - pM[GF23]*pM[GF30];
189  const Double_t det2_23_12 = pM[GF21]*pM[GF32] - pM[GF22]*pM[GF31];
190  const Double_t det2_23_13 = pM[GF21]*pM[GF33] - pM[GF23]*pM[GF31];
191  const Double_t det2_23_23 = pM[GF22]*pM[GF33] - pM[GF23]*pM[GF32];
192 
193  // Find all NECESSARY 3x3 dets: (16 of them)
194 
195  const Double_t det3_012_012 = pM[GF00]*det2_12_12 - pM[GF01]*det2_12_02
196  + pM[GF02]*det2_12_01;
197  const Double_t det3_012_013 = pM[GF00]*det2_12_13 - pM[GF01]*det2_12_03
198  + pM[GF03]*det2_12_01;
199  const Double_t det3_012_023 = pM[GF00]*det2_12_23 - pM[GF02]*det2_12_03
200  + pM[GF03]*det2_12_02;
201  const Double_t det3_012_123 = pM[GF01]*det2_12_23 - pM[GF02]*det2_12_13
202  + pM[GF03]*det2_12_12;
203  const Double_t det3_013_012 = pM[GF00]*det2_13_12 - pM[GF01]*det2_13_02
204  + pM[GF02]*det2_13_01;
205  const Double_t det3_013_013 = pM[GF00]*det2_13_13 - pM[GF01]*det2_13_03
206  + pM[GF03]*det2_13_01;
207  const Double_t det3_013_023 = pM[GF00]*det2_13_23 - pM[GF02]*det2_13_03
208  + pM[GF03]*det2_13_02;
209  const Double_t det3_013_123 = pM[GF01]*det2_13_23 - pM[GF02]*det2_13_13
210  + pM[GF03]*det2_13_12;
211  const Double_t det3_023_012 = pM[GF00]*det2_23_12 - pM[GF01]*det2_23_02
212  + pM[GF02]*det2_23_01;
213  const Double_t det3_023_013 = pM[GF00]*det2_23_13 - pM[GF01]*det2_23_03
214  + pM[GF03]*det2_23_01;
215  const Double_t det3_023_023 = pM[GF00]*det2_23_23 - pM[GF02]*det2_23_03
216  + pM[GF03]*det2_23_02;
217  const Double_t det3_023_123 = pM[GF01]*det2_23_23 - pM[GF02]*det2_23_13
218  + pM[GF03]*det2_23_12;
219  const Double_t det3_123_012 = pM[GF10]*det2_23_12 - pM[GF11]*det2_23_02
220  + pM[GF12]*det2_23_01;
221  const Double_t det3_123_013 = pM[GF10]*det2_23_13 - pM[GF11]*det2_23_03
222  + pM[GF13]*det2_23_01;
223  const Double_t det3_123_023 = pM[GF10]*det2_23_23 - pM[GF12]*det2_23_03
224  + pM[GF13]*det2_23_02;
225  const Double_t det3_123_123 = pM[GF11]*det2_23_23 - pM[GF12]*det2_23_13
226  + pM[GF13]*det2_23_12;
227 
228  // Find the 4x4 det:
229 
230  const Double_t det = pM[GF00]*det3_123_123 - pM[GF01]*det3_123_023
231  + pM[GF02]*det3_123_013 - pM[GF03]*det3_123_012;
232  if (determ)
233  *determ = det;
234 
235  if ( det == 0 ) {
236  Error("Inv4x4","matrix is singular");
237  return kFALSE;
238  }
239 
240  const Double_t oneOverDet = 1.0/det;
241  const Double_t mn1OverDet = - oneOverDet;
242 
243  pM[GF00] = det3_123_123 * oneOverDet;
244  pM[GF01] = det3_023_123 * mn1OverDet;
245  pM[GF02] = det3_013_123 * oneOverDet;
246  pM[GF03] = det3_012_123 * mn1OverDet;
247 
248  pM[GF10] = det3_123_023 * mn1OverDet;
249  pM[GF11] = det3_023_023 * oneOverDet;
250  pM[GF12] = det3_013_023 * mn1OverDet;
251  pM[GF13] = det3_012_023 * oneOverDet;
252 
253  pM[GF20] = det3_123_013 * oneOverDet;
254  pM[GF21] = det3_023_013 * mn1OverDet;
255  pM[GF22] = det3_013_013 * oneOverDet;
256  pM[GF23] = det3_012_013 * mn1OverDet;
257 
258  pM[GF30] = det3_123_012 * mn1OverDet;
259  pM[GF31] = det3_023_012 * oneOverDet;
260  pM[GF32] = det3_013_012 * mn1OverDet;
261  pM[GF33] = det3_012_012 * oneOverDet;
262 
263  return kTRUE;
264 }
265 
266 // GMij are indices for a 5x5 matrix.
267 
268 #define GM00 0
269 #define GM01 1
270 #define GM02 2
271 #define GM03 3
272 #define GM04 4
273 
274 #define GM10 5
275 #define GM11 6
276 #define GM12 7
277 #define GM13 8
278 #define GM14 9
279 
280 #define GM20 10
281 #define GM21 11
282 #define GM22 12
283 #define GM23 13
284 #define GM24 14
285 
286 #define GM30 15
287 #define GM31 16
288 #define GM32 17
289 #define GM33 18
290 #define GM34 19
291 
292 #define GM40 20
293 #define GM41 21
294 #define GM42 22
295 #define GM43 23
296 #define GM44 24
297 
298 ////////////////////////////////////////////////////////////////////////////////
299 
300 template<class Element>
302 {
303  if (m.GetNrows() != 5 || m.GetNcols() != 5 || m.GetRowLwb() != m.GetColLwb()) {
304  Error("Inv5x5","matrix should be square 5x5");
305  return kFALSE;
306  }
307 
308  Element *pM = m.GetMatrixArray();
309 
310  // Find all NECESSARY 2x2 dets: (30 of them)
311 
312  const Double_t det2_23_01 = pM[GM20]*pM[GM31] - pM[GM21]*pM[GM30];
313  const Double_t det2_23_02 = pM[GM20]*pM[GM32] - pM[GM22]*pM[GM30];
314  const Double_t det2_23_03 = pM[GM20]*pM[GM33] - pM[GM23]*pM[GM30];
315  const Double_t det2_23_04 = pM[GM20]*pM[GM34] - pM[GM24]*pM[GM30];
316  const Double_t det2_23_12 = pM[GM21]*pM[GM32] - pM[GM22]*pM[GM31];
317  const Double_t det2_23_13 = pM[GM21]*pM[GM33] - pM[GM23]*pM[GM31];
318  const Double_t det2_23_14 = pM[GM21]*pM[GM34] - pM[GM24]*pM[GM31];
319  const Double_t det2_23_23 = pM[GM22]*pM[GM33] - pM[GM23]*pM[GM32];
320  const Double_t det2_23_24 = pM[GM22]*pM[GM34] - pM[GM24]*pM[GM32];
321  const Double_t det2_23_34 = pM[GM23]*pM[GM34] - pM[GM24]*pM[GM33];
322  const Double_t det2_24_01 = pM[GM20]*pM[GM41] - pM[GM21]*pM[GM40];
323  const Double_t det2_24_02 = pM[GM20]*pM[GM42] - pM[GM22]*pM[GM40];
324  const Double_t det2_24_03 = pM[GM20]*pM[GM43] - pM[GM23]*pM[GM40];
325  const Double_t det2_24_04 = pM[GM20]*pM[GM44] - pM[GM24]*pM[GM40];
326  const Double_t det2_24_12 = pM[GM21]*pM[GM42] - pM[GM22]*pM[GM41];
327  const Double_t det2_24_13 = pM[GM21]*pM[GM43] - pM[GM23]*pM[GM41];
328  const Double_t det2_24_14 = pM[GM21]*pM[GM44] - pM[GM24]*pM[GM41];
329  const Double_t det2_24_23 = pM[GM22]*pM[GM43] - pM[GM23]*pM[GM42];
330  const Double_t det2_24_24 = pM[GM22]*pM[GM44] - pM[GM24]*pM[GM42];
331  const Double_t det2_24_34 = pM[GM23]*pM[GM44] - pM[GM24]*pM[GM43];
332  const Double_t det2_34_01 = pM[GM30]*pM[GM41] - pM[GM31]*pM[GM40];
333  const Double_t det2_34_02 = pM[GM30]*pM[GM42] - pM[GM32]*pM[GM40];
334  const Double_t det2_34_03 = pM[GM30]*pM[GM43] - pM[GM33]*pM[GM40];
335  const Double_t det2_34_04 = pM[GM30]*pM[GM44] - pM[GM34]*pM[GM40];
336  const Double_t det2_34_12 = pM[GM31]*pM[GM42] - pM[GM32]*pM[GM41];
337  const Double_t det2_34_13 = pM[GM31]*pM[GM43] - pM[GM33]*pM[GM41];
338  const Double_t det2_34_14 = pM[GM31]*pM[GM44] - pM[GM34]*pM[GM41];
339  const Double_t det2_34_23 = pM[GM32]*pM[GM43] - pM[GM33]*pM[GM42];
340  const Double_t det2_34_24 = pM[GM32]*pM[GM44] - pM[GM34]*pM[GM42];
341  const Double_t det2_34_34 = pM[GM33]*pM[GM44] - pM[GM34]*pM[GM43];
342 
343  // Find all NECESSARY 3x3 dets: (40 of them)
344 
345  const Double_t det3_123_012 = pM[GM10]*det2_23_12 - pM[GM11]*det2_23_02 + pM[GM12]*det2_23_01;
346  const Double_t det3_123_013 = pM[GM10]*det2_23_13 - pM[GM11]*det2_23_03 + pM[GM13]*det2_23_01;
347  const Double_t det3_123_014 = pM[GM10]*det2_23_14 - pM[GM11]*det2_23_04 + pM[GM14]*det2_23_01;
348  const Double_t det3_123_023 = pM[GM10]*det2_23_23 - pM[GM12]*det2_23_03 + pM[GM13]*det2_23_02;
349  const Double_t det3_123_024 = pM[GM10]*det2_23_24 - pM[GM12]*det2_23_04 + pM[GM14]*det2_23_02;
350  const Double_t det3_123_034 = pM[GM10]*det2_23_34 - pM[GM13]*det2_23_04 + pM[GM14]*det2_23_03;
351  const Double_t det3_123_123 = pM[GM11]*det2_23_23 - pM[GM12]*det2_23_13 + pM[GM13]*det2_23_12;
352  const Double_t det3_123_124 = pM[GM11]*det2_23_24 - pM[GM12]*det2_23_14 + pM[GM14]*det2_23_12;
353  const Double_t det3_123_134 = pM[GM11]*det2_23_34 - pM[GM13]*det2_23_14 + pM[GM14]*det2_23_13;
354  const Double_t det3_123_234 = pM[GM12]*det2_23_34 - pM[GM13]*det2_23_24 + pM[GM14]*det2_23_23;
355  const Double_t det3_124_012 = pM[GM10]*det2_24_12 - pM[GM11]*det2_24_02 + pM[GM12]*det2_24_01;
356  const Double_t det3_124_013 = pM[GM10]*det2_24_13 - pM[GM11]*det2_24_03 + pM[GM13]*det2_24_01;
357  const Double_t det3_124_014 = pM[GM10]*det2_24_14 - pM[GM11]*det2_24_04 + pM[GM14]*det2_24_01;
358  const Double_t det3_124_023 = pM[GM10]*det2_24_23 - pM[GM12]*det2_24_03 + pM[GM13]*det2_24_02;
359  const Double_t det3_124_024 = pM[GM10]*det2_24_24 - pM[GM12]*det2_24_04 + pM[GM14]*det2_24_02;
360  const Double_t det3_124_034 = pM[GM10]*det2_24_34 - pM[GM13]*det2_24_04 + pM[GM14]*det2_24_03;
361  const Double_t det3_124_123 = pM[GM11]*det2_24_23 - pM[GM12]*det2_24_13 + pM[GM13]*det2_24_12;
362  const Double_t det3_124_124 = pM[GM11]*det2_24_24 - pM[GM12]*det2_24_14 + pM[GM14]*det2_24_12;
363  const Double_t det3_124_134 = pM[GM11]*det2_24_34 - pM[GM13]*det2_24_14 + pM[GM14]*det2_24_13;
364  const Double_t det3_124_234 = pM[GM12]*det2_24_34 - pM[GM13]*det2_24_24 + pM[GM14]*det2_24_23;
365  const Double_t det3_134_012 = pM[GM10]*det2_34_12 - pM[GM11]*det2_34_02 + pM[GM12]*det2_34_01;
366  const Double_t det3_134_013 = pM[GM10]*det2_34_13 - pM[GM11]*det2_34_03 + pM[GM13]*det2_34_01;
367  const Double_t det3_134_014 = pM[GM10]*det2_34_14 - pM[GM11]*det2_34_04 + pM[GM14]*det2_34_01;
368  const Double_t det3_134_023 = pM[GM10]*det2_34_23 - pM[GM12]*det2_34_03 + pM[GM13]*det2_34_02;
369  const Double_t det3_134_024 = pM[GM10]*det2_34_24 - pM[GM12]*det2_34_04 + pM[GM14]*det2_34_02;
370  const Double_t det3_134_034 = pM[GM10]*det2_34_34 - pM[GM13]*det2_34_04 + pM[GM14]*det2_34_03;
371  const Double_t det3_134_123 = pM[GM11]*det2_34_23 - pM[GM12]*det2_34_13 + pM[GM13]*det2_34_12;
372  const Double_t det3_134_124 = pM[GM11]*det2_34_24 - pM[GM12]*det2_34_14 + pM[GM14]*det2_34_12;
373  const Double_t det3_134_134 = pM[GM11]*det2_34_34 - pM[GM13]*det2_34_14 + pM[GM14]*det2_34_13;
374  const Double_t det3_134_234 = pM[GM12]*det2_34_34 - pM[GM13]*det2_34_24 + pM[GM14]*det2_34_23;
375  const Double_t det3_234_012 = pM[GM20]*det2_34_12 - pM[GM21]*det2_34_02 + pM[GM22]*det2_34_01;
376  const Double_t det3_234_013 = pM[GM20]*det2_34_13 - pM[GM21]*det2_34_03 + pM[GM23]*det2_34_01;
377  const Double_t det3_234_014 = pM[GM20]*det2_34_14 - pM[GM21]*det2_34_04 + pM[GM24]*det2_34_01;
378  const Double_t det3_234_023 = pM[GM20]*det2_34_23 - pM[GM22]*det2_34_03 + pM[GM23]*det2_34_02;
379  const Double_t det3_234_024 = pM[GM20]*det2_34_24 - pM[GM22]*det2_34_04 + pM[GM24]*det2_34_02;
380  const Double_t det3_234_034 = pM[GM20]*det2_34_34 - pM[GM23]*det2_34_04 + pM[GM24]*det2_34_03;
381  const Double_t det3_234_123 = pM[GM21]*det2_34_23 - pM[GM22]*det2_34_13 + pM[GM23]*det2_34_12;
382  const Double_t det3_234_124 = pM[GM21]*det2_34_24 - pM[GM22]*det2_34_14 + pM[GM24]*det2_34_12;
383  const Double_t det3_234_134 = pM[GM21]*det2_34_34 - pM[GM23]*det2_34_14 + pM[GM24]*det2_34_13;
384  const Double_t det3_234_234 = pM[GM22]*det2_34_34 - pM[GM23]*det2_34_24 + pM[GM24]*det2_34_23;
385 
386  // Find all NECESSARY 4x4 dets: (25 of them)
387 
388  const Double_t det4_0123_0123 = pM[GM00]*det3_123_123 - pM[GM01]*det3_123_023
389  + pM[GM02]*det3_123_013 - pM[GM03]*det3_123_012;
390  const Double_t det4_0123_0124 = pM[GM00]*det3_123_124 - pM[GM01]*det3_123_024
391  + pM[GM02]*det3_123_014 - pM[GM04]*det3_123_012;
392  const Double_t det4_0123_0134 = pM[GM00]*det3_123_134 - pM[GM01]*det3_123_034
393  + pM[GM03]*det3_123_014 - pM[GM04]*det3_123_013;
394  const Double_t det4_0123_0234 = pM[GM00]*det3_123_234 - pM[GM02]*det3_123_034
395  + pM[GM03]*det3_123_024 - pM[GM04]*det3_123_023;
396  const Double_t det4_0123_1234 = pM[GM01]*det3_123_234 - pM[GM02]*det3_123_134
397  + pM[GM03]*det3_123_124 - pM[GM04]*det3_123_123;
398  const Double_t det4_0124_0123 = pM[GM00]*det3_124_123 - pM[GM01]*det3_124_023
399  + pM[GM02]*det3_124_013 - pM[GM03]*det3_124_012;
400  const Double_t det4_0124_0124 = pM[GM00]*det3_124_124 - pM[GM01]*det3_124_024
401  + pM[GM02]*det3_124_014 - pM[GM04]*det3_124_012;
402  const Double_t det4_0124_0134 = pM[GM00]*det3_124_134 - pM[GM01]*det3_124_034
403  + pM[GM03]*det3_124_014 - pM[GM04]*det3_124_013;
404  const Double_t det4_0124_0234 = pM[GM00]*det3_124_234 - pM[GM02]*det3_124_034
405  + pM[GM03]*det3_124_024 - pM[GM04]*det3_124_023;
406  const Double_t det4_0124_1234 = pM[GM01]*det3_124_234 - pM[GM02]*det3_124_134
407  + pM[GM03]*det3_124_124 - pM[GM04]*det3_124_123;
408  const Double_t det4_0134_0123 = pM[GM00]*det3_134_123 - pM[GM01]*det3_134_023
409  + pM[GM02]*det3_134_013 - pM[GM03]*det3_134_012;
410  const Double_t det4_0134_0124 = pM[GM00]*det3_134_124 - pM[GM01]*det3_134_024
411  + pM[GM02]*det3_134_014 - pM[GM04]*det3_134_012;
412  const Double_t det4_0134_0134 = pM[GM00]*det3_134_134 - pM[GM01]*det3_134_034
413  + pM[GM03]*det3_134_014 - pM[GM04]*det3_134_013;
414  const Double_t det4_0134_0234 = pM[GM00]*det3_134_234 - pM[GM02]*det3_134_034
415  + pM[GM03]*det3_134_024 - pM[GM04]*det3_134_023;
416  const Double_t det4_0134_1234 = pM[GM01]*det3_134_234 - pM[GM02]*det3_134_134
417  + pM[GM03]*det3_134_124 - pM[GM04]*det3_134_123;
418  const Double_t det4_0234_0123 = pM[GM00]*det3_234_123 - pM[GM01]*det3_234_023
419  + pM[GM02]*det3_234_013 - pM[GM03]*det3_234_012;
420  const Double_t det4_0234_0124 = pM[GM00]*det3_234_124 - pM[GM01]*det3_234_024
421  + pM[GM02]*det3_234_014 - pM[GM04]*det3_234_012;
422  const Double_t det4_0234_0134 = pM[GM00]*det3_234_134 - pM[GM01]*det3_234_034
423  + pM[GM03]*det3_234_014 - pM[GM04]*det3_234_013;
424  const Double_t det4_0234_0234 = pM[GM00]*det3_234_234 - pM[GM02]*det3_234_034
425  + pM[GM03]*det3_234_024 - pM[GM04]*det3_234_023;
426  const Double_t det4_0234_1234 = pM[GM01]*det3_234_234 - pM[GM02]*det3_234_134
427  + pM[GM03]*det3_234_124 - pM[GM04]*det3_234_123;
428  const Double_t det4_1234_0123 = pM[GM10]*det3_234_123 - pM[GM11]*det3_234_023
429  + pM[GM12]*det3_234_013 - pM[GM13]*det3_234_012;
430  const Double_t det4_1234_0124 = pM[GM10]*det3_234_124 - pM[GM11]*det3_234_024
431  + pM[GM12]*det3_234_014 - pM[GM14]*det3_234_012;
432  const Double_t det4_1234_0134 = pM[GM10]*det3_234_134 - pM[GM11]*det3_234_034
433  + pM[GM13]*det3_234_014 - pM[GM14]*det3_234_013;
434  const Double_t det4_1234_0234 = pM[GM10]*det3_234_234 - pM[GM12]*det3_234_034
435  + pM[GM13]*det3_234_024 - pM[GM14]*det3_234_023;
436  const Double_t det4_1234_1234 = pM[GM11]*det3_234_234 - pM[GM12]*det3_234_134
437  + pM[GM13]*det3_234_124 - pM[GM14]*det3_234_123;
438 
439  // Find the 5x5 det:
440 
441  const Double_t det = pM[GM00]*det4_1234_1234 - pM[GM01]*det4_1234_0234 + pM[GM02]*det4_1234_0134
442  - pM[GM03]*det4_1234_0124 + pM[GM04]*det4_1234_0123;
443  if (determ)
444  *determ = det;
445 
446  if ( det == 0 ) {
447  Error("Inv5x5","matrix is singular");
448  return kFALSE;
449  }
450 
451  const Double_t oneOverDet = 1.0/det;
452  const Double_t mn1OverDet = - oneOverDet;
453 
454  pM[GM00] = det4_1234_1234 * oneOverDet;
455  pM[GM01] = det4_0234_1234 * mn1OverDet;
456  pM[GM02] = det4_0134_1234 * oneOverDet;
457  pM[GM03] = det4_0124_1234 * mn1OverDet;
458  pM[GM04] = det4_0123_1234 * oneOverDet;
459 
460  pM[GM10] = det4_1234_0234 * mn1OverDet;
461  pM[GM11] = det4_0234_0234 * oneOverDet;
462  pM[GM12] = det4_0134_0234 * mn1OverDet;
463  pM[GM13] = det4_0124_0234 * oneOverDet;
464  pM[GM14] = det4_0123_0234 * mn1OverDet;
465 
466  pM[GM20] = det4_1234_0134 * oneOverDet;
467  pM[GM21] = det4_0234_0134 * mn1OverDet;
468  pM[GM22] = det4_0134_0134 * oneOverDet;
469  pM[GM23] = det4_0124_0134 * mn1OverDet;
470  pM[GM24] = det4_0123_0134 * oneOverDet;
471 
472  pM[GM30] = det4_1234_0124 * mn1OverDet;
473  pM[GM31] = det4_0234_0124 * oneOverDet;
474  pM[GM32] = det4_0134_0124 * mn1OverDet;
475  pM[GM33] = det4_0124_0124 * oneOverDet;
476  pM[GM34] = det4_0123_0124 * mn1OverDet;
477 
478  pM[GM40] = det4_1234_0123 * oneOverDet;
479  pM[GM41] = det4_0234_0123 * mn1OverDet;
480  pM[GM42] = det4_0134_0123 * oneOverDet;
481  pM[GM43] = det4_0124_0123 * mn1OverDet;
482  pM[GM44] = det4_0123_0123 * oneOverDet;
483 
484  return kTRUE;
485 }
486 
487 // Aij are indices for a 6x6 matrix.
488 
489 #define GA00 0
490 #define GA01 1
491 #define GA02 2
492 #define GA03 3
493 #define GA04 4
494 #define GA05 5
495 
496 #define GA10 6
497 #define GA11 7
498 #define GA12 8
499 #define GA13 9
500 #define GA14 10
501 #define GA15 11
502 
503 #define GA20 12
504 #define GA21 13
505 #define GA22 14
506 #define GA23 15
507 #define GA24 16
508 #define GA25 17
509 
510 #define GA30 18
511 #define GA31 19
512 #define GA32 20
513 #define GA33 21
514 #define GA34 22
515 #define GA35 23
516 
517 #define GA40 24
518 #define GA41 25
519 #define GA42 26
520 #define GA43 27
521 #define GA44 28
522 #define GA45 29
523 
524 #define GA50 30
525 #define GA51 31
526 #define GA52 32
527 #define GA53 33
528 #define GA54 34
529 #define GA55 35
530 
531 ////////////////////////////////////////////////////////////////////////////////
532 
533 template<class Element>
535 {
536  if (m.GetNrows() != 6 || m.GetNcols() != 6 || m.GetRowLwb() != m.GetColLwb()) {
537  Error("Inv6x6","matrix should be square 6x6");
538  return kFALSE;
539  }
540 
541  Element *pM = m.GetMatrixArray();
542 
543  // Find all NECESSGARY 2x2 dets: (45 of them)
544 
545  const Double_t det2_34_01 = pM[GA30]*pM[GA41] - pM[GA31]*pM[GA40];
546  const Double_t det2_34_02 = pM[GA30]*pM[GA42] - pM[GA32]*pM[GA40];
547  const Double_t det2_34_03 = pM[GA30]*pM[GA43] - pM[GA33]*pM[GA40];
548  const Double_t det2_34_04 = pM[GA30]*pM[GA44] - pM[GA34]*pM[GA40];
549  const Double_t det2_34_05 = pM[GA30]*pM[GA45] - pM[GA35]*pM[GA40];
550  const Double_t det2_34_12 = pM[GA31]*pM[GA42] - pM[GA32]*pM[GA41];
551  const Double_t det2_34_13 = pM[GA31]*pM[GA43] - pM[GA33]*pM[GA41];
552  const Double_t det2_34_14 = pM[GA31]*pM[GA44] - pM[GA34]*pM[GA41];
553  const Double_t det2_34_15 = pM[GA31]*pM[GA45] - pM[GA35]*pM[GA41];
554  const Double_t det2_34_23 = pM[GA32]*pM[GA43] - pM[GA33]*pM[GA42];
555  const Double_t det2_34_24 = pM[GA32]*pM[GA44] - pM[GA34]*pM[GA42];
556  const Double_t det2_34_25 = pM[GA32]*pM[GA45] - pM[GA35]*pM[GA42];
557  const Double_t det2_34_34 = pM[GA33]*pM[GA44] - pM[GA34]*pM[GA43];
558  const Double_t det2_34_35 = pM[GA33]*pM[GA45] - pM[GA35]*pM[GA43];
559  const Double_t det2_34_45 = pM[GA34]*pM[GA45] - pM[GA35]*pM[GA44];
560  const Double_t det2_35_01 = pM[GA30]*pM[GA51] - pM[GA31]*pM[GA50];
561  const Double_t det2_35_02 = pM[GA30]*pM[GA52] - pM[GA32]*pM[GA50];
562  const Double_t det2_35_03 = pM[GA30]*pM[GA53] - pM[GA33]*pM[GA50];
563  const Double_t det2_35_04 = pM[GA30]*pM[GA54] - pM[GA34]*pM[GA50];
564  const Double_t det2_35_05 = pM[GA30]*pM[GA55] - pM[GA35]*pM[GA50];
565  const Double_t det2_35_12 = pM[GA31]*pM[GA52] - pM[GA32]*pM[GA51];
566  const Double_t det2_35_13 = pM[GA31]*pM[GA53] - pM[GA33]*pM[GA51];
567  const Double_t det2_35_14 = pM[GA31]*pM[GA54] - pM[GA34]*pM[GA51];
568  const Double_t det2_35_15 = pM[GA31]*pM[GA55] - pM[GA35]*pM[GA51];
569  const Double_t det2_35_23 = pM[GA32]*pM[GA53] - pM[GA33]*pM[GA52];
570  const Double_t det2_35_24 = pM[GA32]*pM[GA54] - pM[GA34]*pM[GA52];
571  const Double_t det2_35_25 = pM[GA32]*pM[GA55] - pM[GA35]*pM[GA52];
572  const Double_t det2_35_34 = pM[GA33]*pM[GA54] - pM[GA34]*pM[GA53];
573  const Double_t det2_35_35 = pM[GA33]*pM[GA55] - pM[GA35]*pM[GA53];
574  const Double_t det2_35_45 = pM[GA34]*pM[GA55] - pM[GA35]*pM[GA54];
575  const Double_t det2_45_01 = pM[GA40]*pM[GA51] - pM[GA41]*pM[GA50];
576  const Double_t det2_45_02 = pM[GA40]*pM[GA52] - pM[GA42]*pM[GA50];
577  const Double_t det2_45_03 = pM[GA40]*pM[GA53] - pM[GA43]*pM[GA50];
578  const Double_t det2_45_04 = pM[GA40]*pM[GA54] - pM[GA44]*pM[GA50];
579  const Double_t det2_45_05 = pM[GA40]*pM[GA55] - pM[GA45]*pM[GA50];
580  const Double_t det2_45_12 = pM[GA41]*pM[GA52] - pM[GA42]*pM[GA51];
581  const Double_t det2_45_13 = pM[GA41]*pM[GA53] - pM[GA43]*pM[GA51];
582  const Double_t det2_45_14 = pM[GA41]*pM[GA54] - pM[GA44]*pM[GA51];
583  const Double_t det2_45_15 = pM[GA41]*pM[GA55] - pM[GA45]*pM[GA51];
584  const Double_t det2_45_23 = pM[GA42]*pM[GA53] - pM[GA43]*pM[GA52];
585  const Double_t det2_45_24 = pM[GA42]*pM[GA54] - pM[GA44]*pM[GA52];
586  const Double_t det2_45_25 = pM[GA42]*pM[GA55] - pM[GA45]*pM[GA52];
587  const Double_t det2_45_34 = pM[GA43]*pM[GA54] - pM[GA44]*pM[GA53];
588  const Double_t det2_45_35 = pM[GA43]*pM[GA55] - pM[GA45]*pM[GA53];
589  const Double_t det2_45_45 = pM[GA44]*pM[GA55] - pM[GA45]*pM[GA54];
590 
591  // Find all NECESSGARY 3x3 dets: (80 of them)
592 
593  const Double_t det3_234_012 = pM[GA20]*det2_34_12 - pM[GA21]*det2_34_02 + pM[GA22]*det2_34_01;
594  const Double_t det3_234_013 = pM[GA20]*det2_34_13 - pM[GA21]*det2_34_03 + pM[GA23]*det2_34_01;
595  const Double_t det3_234_014 = pM[GA20]*det2_34_14 - pM[GA21]*det2_34_04 + pM[GA24]*det2_34_01;
596  const Double_t det3_234_015 = pM[GA20]*det2_34_15 - pM[GA21]*det2_34_05 + pM[GA25]*det2_34_01;
597  const Double_t det3_234_023 = pM[GA20]*det2_34_23 - pM[GA22]*det2_34_03 + pM[GA23]*det2_34_02;
598  const Double_t det3_234_024 = pM[GA20]*det2_34_24 - pM[GA22]*det2_34_04 + pM[GA24]*det2_34_02;
599  const Double_t det3_234_025 = pM[GA20]*det2_34_25 - pM[GA22]*det2_34_05 + pM[GA25]*det2_34_02;
600  const Double_t det3_234_034 = pM[GA20]*det2_34_34 - pM[GA23]*det2_34_04 + pM[GA24]*det2_34_03;
601  const Double_t det3_234_035 = pM[GA20]*det2_34_35 - pM[GA23]*det2_34_05 + pM[GA25]*det2_34_03;
602  const Double_t det3_234_045 = pM[GA20]*det2_34_45 - pM[GA24]*det2_34_05 + pM[GA25]*det2_34_04;
603  const Double_t det3_234_123 = pM[GA21]*det2_34_23 - pM[GA22]*det2_34_13 + pM[GA23]*det2_34_12;
604  const Double_t det3_234_124 = pM[GA21]*det2_34_24 - pM[GA22]*det2_34_14 + pM[GA24]*det2_34_12;
605  const Double_t det3_234_125 = pM[GA21]*det2_34_25 - pM[GA22]*det2_34_15 + pM[GA25]*det2_34_12;
606  const Double_t det3_234_134 = pM[GA21]*det2_34_34 - pM[GA23]*det2_34_14 + pM[GA24]*det2_34_13;
607  const Double_t det3_234_135 = pM[GA21]*det2_34_35 - pM[GA23]*det2_34_15 + pM[GA25]*det2_34_13;
608  const Double_t det3_234_145 = pM[GA21]*det2_34_45 - pM[GA24]*det2_34_15 + pM[GA25]*det2_34_14;
609  const Double_t det3_234_234 = pM[GA22]*det2_34_34 - pM[GA23]*det2_34_24 + pM[GA24]*det2_34_23;
610  const Double_t det3_234_235 = pM[GA22]*det2_34_35 - pM[GA23]*det2_34_25 + pM[GA25]*det2_34_23;
611  const Double_t det3_234_245 = pM[GA22]*det2_34_45 - pM[GA24]*det2_34_25 + pM[GA25]*det2_34_24;
612  const Double_t det3_234_345 = pM[GA23]*det2_34_45 - pM[GA24]*det2_34_35 + pM[GA25]*det2_34_34;
613  const Double_t det3_235_012 = pM[GA20]*det2_35_12 - pM[GA21]*det2_35_02 + pM[GA22]*det2_35_01;
614  const Double_t det3_235_013 = pM[GA20]*det2_35_13 - pM[GA21]*det2_35_03 + pM[GA23]*det2_35_01;
615  const Double_t det3_235_014 = pM[GA20]*det2_35_14 - pM[GA21]*det2_35_04 + pM[GA24]*det2_35_01;
616  const Double_t det3_235_015 = pM[GA20]*det2_35_15 - pM[GA21]*det2_35_05 + pM[GA25]*det2_35_01;
617  const Double_t det3_235_023 = pM[GA20]*det2_35_23 - pM[GA22]*det2_35_03 + pM[GA23]*det2_35_02;
618  const Double_t det3_235_024 = pM[GA20]*det2_35_24 - pM[GA22]*det2_35_04 + pM[GA24]*det2_35_02;
619  const Double_t det3_235_025 = pM[GA20]*det2_35_25 - pM[GA22]*det2_35_05 + pM[GA25]*det2_35_02;
620  const Double_t det3_235_034 = pM[GA20]*det2_35_34 - pM[GA23]*det2_35_04 + pM[GA24]*det2_35_03;
621  const Double_t det3_235_035 = pM[GA20]*det2_35_35 - pM[GA23]*det2_35_05 + pM[GA25]*det2_35_03;
622  const Double_t det3_235_045 = pM[GA20]*det2_35_45 - pM[GA24]*det2_35_05 + pM[GA25]*det2_35_04;
623  const Double_t det3_235_123 = pM[GA21]*det2_35_23 - pM[GA22]*det2_35_13 + pM[GA23]*det2_35_12;
624  const Double_t det3_235_124 = pM[GA21]*det2_35_24 - pM[GA22]*det2_35_14 + pM[GA24]*det2_35_12;
625  const Double_t det3_235_125 = pM[GA21]*det2_35_25 - pM[GA22]*det2_35_15 + pM[GA25]*det2_35_12;
626  const Double_t det3_235_134 = pM[GA21]*det2_35_34 - pM[GA23]*det2_35_14 + pM[GA24]*det2_35_13;
627  const Double_t det3_235_135 = pM[GA21]*det2_35_35 - pM[GA23]*det2_35_15 + pM[GA25]*det2_35_13;
628  const Double_t det3_235_145 = pM[GA21]*det2_35_45 - pM[GA24]*det2_35_15 + pM[GA25]*det2_35_14;
629  const Double_t det3_235_234 = pM[GA22]*det2_35_34 - pM[GA23]*det2_35_24 + pM[GA24]*det2_35_23;
630  const Double_t det3_235_235 = pM[GA22]*det2_35_35 - pM[GA23]*det2_35_25 + pM[GA25]*det2_35_23;
631  const Double_t det3_235_245 = pM[GA22]*det2_35_45 - pM[GA24]*det2_35_25 + pM[GA25]*det2_35_24;
632  const Double_t det3_235_345 = pM[GA23]*det2_35_45 - pM[GA24]*det2_35_35 + pM[GA25]*det2_35_34;
633  const Double_t det3_245_012 = pM[GA20]*det2_45_12 - pM[GA21]*det2_45_02 + pM[GA22]*det2_45_01;
634  const Double_t det3_245_013 = pM[GA20]*det2_45_13 - pM[GA21]*det2_45_03 + pM[GA23]*det2_45_01;
635  const Double_t det3_245_014 = pM[GA20]*det2_45_14 - pM[GA21]*det2_45_04 + pM[GA24]*det2_45_01;
636  const Double_t det3_245_015 = pM[GA20]*det2_45_15 - pM[GA21]*det2_45_05 + pM[GA25]*det2_45_01;
637  const Double_t det3_245_023 = pM[GA20]*det2_45_23 - pM[GA22]*det2_45_03 + pM[GA23]*det2_45_02;
638  const Double_t det3_245_024 = pM[GA20]*det2_45_24 - pM[GA22]*det2_45_04 + pM[GA24]*det2_45_02;
639  const Double_t det3_245_025 = pM[GA20]*det2_45_25 - pM[GA22]*det2_45_05 + pM[GA25]*det2_45_02;
640  const Double_t det3_245_034 = pM[GA20]*det2_45_34 - pM[GA23]*det2_45_04 + pM[GA24]*det2_45_03;
641  const Double_t det3_245_035 = pM[GA20]*det2_45_35 - pM[GA23]*det2_45_05 + pM[GA25]*det2_45_03;
642  const Double_t det3_245_045 = pM[GA20]*det2_45_45 - pM[GA24]*det2_45_05 + pM[GA25]*det2_45_04;
643  const Double_t det3_245_123 = pM[GA21]*det2_45_23 - pM[GA22]*det2_45_13 + pM[GA23]*det2_45_12;
644  const Double_t det3_245_124 = pM[GA21]*det2_45_24 - pM[GA22]*det2_45_14 + pM[GA24]*det2_45_12;
645  const Double_t det3_245_125 = pM[GA21]*det2_45_25 - pM[GA22]*det2_45_15 + pM[GA25]*det2_45_12;
646  const Double_t det3_245_134 = pM[GA21]*det2_45_34 - pM[GA23]*det2_45_14 + pM[GA24]*det2_45_13;
647  const Double_t det3_245_135 = pM[GA21]*det2_45_35 - pM[GA23]*det2_45_15 + pM[GA25]*det2_45_13;
648  const Double_t det3_245_145 = pM[GA21]*det2_45_45 - pM[GA24]*det2_45_15 + pM[GA25]*det2_45_14;
649  const Double_t det3_245_234 = pM[GA22]*det2_45_34 - pM[GA23]*det2_45_24 + pM[GA24]*det2_45_23;
650  const Double_t det3_245_235 = pM[GA22]*det2_45_35 - pM[GA23]*det2_45_25 + pM[GA25]*det2_45_23;
651  const Double_t det3_245_245 = pM[GA22]*det2_45_45 - pM[GA24]*det2_45_25 + pM[GA25]*det2_45_24;
652  const Double_t det3_245_345 = pM[GA23]*det2_45_45 - pM[GA24]*det2_45_35 + pM[GA25]*det2_45_34;
653  const Double_t det3_345_012 = pM[GA30]*det2_45_12 - pM[GA31]*det2_45_02 + pM[GA32]*det2_45_01;
654  const Double_t det3_345_013 = pM[GA30]*det2_45_13 - pM[GA31]*det2_45_03 + pM[GA33]*det2_45_01;
655  const Double_t det3_345_014 = pM[GA30]*det2_45_14 - pM[GA31]*det2_45_04 + pM[GA34]*det2_45_01;
656  const Double_t det3_345_015 = pM[GA30]*det2_45_15 - pM[GA31]*det2_45_05 + pM[GA35]*det2_45_01;
657  const Double_t det3_345_023 = pM[GA30]*det2_45_23 - pM[GA32]*det2_45_03 + pM[GA33]*det2_45_02;
658  const Double_t det3_345_024 = pM[GA30]*det2_45_24 - pM[GA32]*det2_45_04 + pM[GA34]*det2_45_02;
659  const Double_t det3_345_025 = pM[GA30]*det2_45_25 - pM[GA32]*det2_45_05 + pM[GA35]*det2_45_02;
660  const Double_t det3_345_034 = pM[GA30]*det2_45_34 - pM[GA33]*det2_45_04 + pM[GA34]*det2_45_03;
661  const Double_t det3_345_035 = pM[GA30]*det2_45_35 - pM[GA33]*det2_45_05 + pM[GA35]*det2_45_03;
662  const Double_t det3_345_045 = pM[GA30]*det2_45_45 - pM[GA34]*det2_45_05 + pM[GA35]*det2_45_04;
663  const Double_t det3_345_123 = pM[GA31]*det2_45_23 - pM[GA32]*det2_45_13 + pM[GA33]*det2_45_12;
664  const Double_t det3_345_124 = pM[GA31]*det2_45_24 - pM[GA32]*det2_45_14 + pM[GA34]*det2_45_12;
665  const Double_t det3_345_125 = pM[GA31]*det2_45_25 - pM[GA32]*det2_45_15 + pM[GA35]*det2_45_12;
666  const Double_t det3_345_134 = pM[GA31]*det2_45_34 - pM[GA33]*det2_45_14 + pM[GA34]*det2_45_13;
667  const Double_t det3_345_135 = pM[GA31]*det2_45_35 - pM[GA33]*det2_45_15 + pM[GA35]*det2_45_13;
668  const Double_t det3_345_145 = pM[GA31]*det2_45_45 - pM[GA34]*det2_45_15 + pM[GA35]*det2_45_14;
669  const Double_t det3_345_234 = pM[GA32]*det2_45_34 - pM[GA33]*det2_45_24 + pM[GA34]*det2_45_23;
670  const Double_t det3_345_235 = pM[GA32]*det2_45_35 - pM[GA33]*det2_45_25 + pM[GA35]*det2_45_23;
671  const Double_t det3_345_245 = pM[GA32]*det2_45_45 - pM[GA34]*det2_45_25 + pM[GA35]*det2_45_24;
672  const Double_t det3_345_345 = pM[GA33]*det2_45_45 - pM[GA34]*det2_45_35 + pM[GA35]*det2_45_34;
673 
674  // Find all NECESSGARY 4x4 dets: (75 of them)
675 
676  const Double_t det4_1234_0123 = pM[GA10]*det3_234_123 - pM[GA11]*det3_234_023
677  + pM[GA12]*det3_234_013 - pM[GA13]*det3_234_012;
678  const Double_t det4_1234_0124 = pM[GA10]*det3_234_124 - pM[GA11]*det3_234_024
679  + pM[GA12]*det3_234_014 - pM[GA14]*det3_234_012;
680  const Double_t det4_1234_0125 = pM[GA10]*det3_234_125 - pM[GA11]*det3_234_025
681  + pM[GA12]*det3_234_015 - pM[GA15]*det3_234_012;
682  const Double_t det4_1234_0134 = pM[GA10]*det3_234_134 - pM[GA11]*det3_234_034
683  + pM[GA13]*det3_234_014 - pM[GA14]*det3_234_013;
684  const Double_t det4_1234_0135 = pM[GA10]*det3_234_135 - pM[GA11]*det3_234_035
685  + pM[GA13]*det3_234_015 - pM[GA15]*det3_234_013;
686  const Double_t det4_1234_0145 = pM[GA10]*det3_234_145 - pM[GA11]*det3_234_045
687  + pM[GA14]*det3_234_015 - pM[GA15]*det3_234_014;
688  const Double_t det4_1234_0234 = pM[GA10]*det3_234_234 - pM[GA12]*det3_234_034
689  + pM[GA13]*det3_234_024 - pM[GA14]*det3_234_023;
690  const Double_t det4_1234_0235 = pM[GA10]*det3_234_235 - pM[GA12]*det3_234_035
691  + pM[GA13]*det3_234_025 - pM[GA15]*det3_234_023;
692  const Double_t det4_1234_0245 = pM[GA10]*det3_234_245 - pM[GA12]*det3_234_045
693  + pM[GA14]*det3_234_025 - pM[GA15]*det3_234_024;
694  const Double_t det4_1234_0345 = pM[GA10]*det3_234_345 - pM[GA13]*det3_234_045
695  + pM[GA14]*det3_234_035 - pM[GA15]*det3_234_034;
696  const Double_t det4_1234_1234 = pM[GA11]*det3_234_234 - pM[GA12]*det3_234_134
697  + pM[GA13]*det3_234_124 - pM[GA14]*det3_234_123;
698  const Double_t det4_1234_1235 = pM[GA11]*det3_234_235 - pM[GA12]*det3_234_135
699  + pM[GA13]*det3_234_125 - pM[GA15]*det3_234_123;
700  const Double_t det4_1234_1245 = pM[GA11]*det3_234_245 - pM[GA12]*det3_234_145
701  + pM[GA14]*det3_234_125 - pM[GA15]*det3_234_124;
702  const Double_t det4_1234_1345 = pM[GA11]*det3_234_345 - pM[GA13]*det3_234_145
703  + pM[GA14]*det3_234_135 - pM[GA15]*det3_234_134;
704  const Double_t det4_1234_2345 = pM[GA12]*det3_234_345 - pM[GA13]*det3_234_245
705  + pM[GA14]*det3_234_235 - pM[GA15]*det3_234_234;
706  const Double_t det4_1235_0123 = pM[GA10]*det3_235_123 - pM[GA11]*det3_235_023
707  + pM[GA12]*det3_235_013 - pM[GA13]*det3_235_012;
708  const Double_t det4_1235_0124 = pM[GA10]*det3_235_124 - pM[GA11]*det3_235_024
709  + pM[GA12]*det3_235_014 - pM[GA14]*det3_235_012;
710  const Double_t det4_1235_0125 = pM[GA10]*det3_235_125 - pM[GA11]*det3_235_025
711  + pM[GA12]*det3_235_015 - pM[GA15]*det3_235_012;
712  const Double_t det4_1235_0134 = pM[GA10]*det3_235_134 - pM[GA11]*det3_235_034
713  + pM[GA13]*det3_235_014 - pM[GA14]*det3_235_013;
714  const Double_t det4_1235_0135 = pM[GA10]*det3_235_135 - pM[GA11]*det3_235_035
715  + pM[GA13]*det3_235_015 - pM[GA15]*det3_235_013;
716  const Double_t det4_1235_0145 = pM[GA10]*det3_235_145 - pM[GA11]*det3_235_045
717  + pM[GA14]*det3_235_015 - pM[GA15]*det3_235_014;
718  const Double_t det4_1235_0234 = pM[GA10]*det3_235_234 - pM[GA12]*det3_235_034
719  + pM[GA13]*det3_235_024 - pM[GA14]*det3_235_023;
720  const Double_t det4_1235_0235 = pM[GA10]*det3_235_235 - pM[GA12]*det3_235_035
721  + pM[GA13]*det3_235_025 - pM[GA15]*det3_235_023;
722  const Double_t det4_1235_0245 = pM[GA10]*det3_235_245 - pM[GA12]*det3_235_045
723  + pM[GA14]*det3_235_025 - pM[GA15]*det3_235_024;
724  const Double_t det4_1235_0345 = pM[GA10]*det3_235_345 - pM[GA13]*det3_235_045
725  + pM[GA14]*det3_235_035 - pM[GA15]*det3_235_034;
726  const Double_t det4_1235_1234 = pM[GA11]*det3_235_234 - pM[GA12]*det3_235_134
727  + pM[GA13]*det3_235_124 - pM[GA14]*det3_235_123;
728  const Double_t det4_1235_1235 = pM[GA11]*det3_235_235 - pM[GA12]*det3_235_135
729  + pM[GA13]*det3_235_125 - pM[GA15]*det3_235_123;
730  const Double_t det4_1235_1245 = pM[GA11]*det3_235_245 - pM[GA12]*det3_235_145
731  + pM[GA14]*det3_235_125 - pM[GA15]*det3_235_124;
732  const Double_t det4_1235_1345 = pM[GA11]*det3_235_345 - pM[GA13]*det3_235_145
733  + pM[GA14]*det3_235_135 - pM[GA15]*det3_235_134;
734  const Double_t det4_1235_2345 = pM[GA12]*det3_235_345 - pM[GA13]*det3_235_245
735  + pM[GA14]*det3_235_235 - pM[GA15]*det3_235_234;
736  const Double_t det4_1245_0123 = pM[GA10]*det3_245_123 - pM[GA11]*det3_245_023
737  + pM[GA12]*det3_245_013 - pM[GA13]*det3_245_012;
738  const Double_t det4_1245_0124 = pM[GA10]*det3_245_124 - pM[GA11]*det3_245_024
739  + pM[GA12]*det3_245_014 - pM[GA14]*det3_245_012;
740  const Double_t det4_1245_0125 = pM[GA10]*det3_245_125 - pM[GA11]*det3_245_025
741  + pM[GA12]*det3_245_015 - pM[GA15]*det3_245_012;
742  const Double_t det4_1245_0134 = pM[GA10]*det3_245_134 - pM[GA11]*det3_245_034
743  + pM[GA13]*det3_245_014 - pM[GA14]*det3_245_013;
744  const Double_t det4_1245_0135 = pM[GA10]*det3_245_135 - pM[GA11]*det3_245_035
745  + pM[GA13]*det3_245_015 - pM[GA15]*det3_245_013;
746  const Double_t det4_1245_0145 = pM[GA10]*det3_245_145 - pM[GA11]*det3_245_045
747  + pM[GA14]*det3_245_015 - pM[GA15]*det3_245_014;
748  const Double_t det4_1245_0234 = pM[GA10]*det3_245_234 - pM[GA12]*det3_245_034
749  + pM[GA13]*det3_245_024 - pM[GA14]*det3_245_023;
750  const Double_t det4_1245_0235 = pM[GA10]*det3_245_235 - pM[GA12]*det3_245_035
751  + pM[GA13]*det3_245_025 - pM[GA15]*det3_245_023;
752  const Double_t det4_1245_0245 = pM[GA10]*det3_245_245 - pM[GA12]*det3_245_045
753  + pM[GA14]*det3_245_025 - pM[GA15]*det3_245_024;
754  const Double_t det4_1245_0345 = pM[GA10]*det3_245_345 - pM[GA13]*det3_245_045
755  + pM[GA14]*det3_245_035 - pM[GA15]*det3_245_034;
756  const Double_t det4_1245_1234 = pM[GA11]*det3_245_234 - pM[GA12]*det3_245_134
757  + pM[GA13]*det3_245_124 - pM[GA14]*det3_245_123;
758  const Double_t det4_1245_1235 = pM[GA11]*det3_245_235 - pM[GA12]*det3_245_135
759  + pM[GA13]*det3_245_125 - pM[GA15]*det3_245_123;
760  const Double_t det4_1245_1245 = pM[GA11]*det3_245_245 - pM[GA12]*det3_245_145
761  + pM[GA14]*det3_245_125 - pM[GA15]*det3_245_124;
762  const Double_t det4_1245_1345 = pM[GA11]*det3_245_345 - pM[GA13]*det3_245_145
763  + pM[GA14]*det3_245_135 - pM[GA15]*det3_245_134;
764  const Double_t det4_1245_2345 = pM[GA12]*det3_245_345 - pM[GA13]*det3_245_245
765  + pM[GA14]*det3_245_235 - pM[GA15]*det3_245_234;
766  const Double_t det4_1345_0123 = pM[GA10]*det3_345_123 - pM[GA11]*det3_345_023
767  + pM[GA12]*det3_345_013 - pM[GA13]*det3_345_012;
768  const Double_t det4_1345_0124 = pM[GA10]*det3_345_124 - pM[GA11]*det3_345_024
769  + pM[GA12]*det3_345_014 - pM[GA14]*det3_345_012;
770  const Double_t det4_1345_0125 = pM[GA10]*det3_345_125 - pM[GA11]*det3_345_025
771  + pM[GA12]*det3_345_015 - pM[GA15]*det3_345_012;
772  const Double_t det4_1345_0134 = pM[GA10]*det3_345_134 - pM[GA11]*det3_345_034
773  + pM[GA13]*det3_345_014 - pM[GA14]*det3_345_013;
774  const Double_t det4_1345_0135 = pM[GA10]*det3_345_135 - pM[GA11]*det3_345_035
775  + pM[GA13]*det3_345_015 - pM[GA15]*det3_345_013;
776  const Double_t det4_1345_0145 = pM[GA10]*det3_345_145 - pM[GA11]*det3_345_045
777  + pM[GA14]*det3_345_015 - pM[GA15]*det3_345_014;
778  const Double_t det4_1345_0234 = pM[GA10]*det3_345_234 - pM[GA12]*det3_345_034
779  + pM[GA13]*det3_345_024 - pM[GA14]*det3_345_023;
780  const Double_t det4_1345_0235 = pM[GA10]*det3_345_235 - pM[GA12]*det3_345_035
781  + pM[GA13]*det3_345_025 - pM[GA15]*det3_345_023;
782  const Double_t det4_1345_0245 = pM[GA10]*det3_345_245 - pM[GA12]*det3_345_045
783  + pM[GA14]*det3_345_025 - pM[GA15]*det3_345_024;
784  const Double_t det4_1345_0345 = pM[GA10]*det3_345_345 - pM[GA13]*det3_345_045
785  + pM[GA14]*det3_345_035 - pM[GA15]*det3_345_034;
786  const Double_t det4_1345_1234 = pM[GA11]*det3_345_234 - pM[GA12]*det3_345_134
787  + pM[GA13]*det3_345_124 - pM[GA14]*det3_345_123;
788  const Double_t det4_1345_1235 = pM[GA11]*det3_345_235 - pM[GA12]*det3_345_135
789  + pM[GA13]*det3_345_125 - pM[GA15]*det3_345_123;
790  const Double_t det4_1345_1245 = pM[GA11]*det3_345_245 - pM[GA12]*det3_345_145
791  + pM[GA14]*det3_345_125 - pM[GA15]*det3_345_124;
792  const Double_t det4_1345_1345 = pM[GA11]*det3_345_345 - pM[GA13]*det3_345_145
793  + pM[GA14]*det3_345_135 - pM[GA15]*det3_345_134;
794  const Double_t det4_1345_2345 = pM[GA12]*det3_345_345 - pM[GA13]*det3_345_245
795  + pM[GA14]*det3_345_235 - pM[GA15]*det3_345_234;
796  const Double_t det4_2345_0123 = pM[GA20]*det3_345_123 - pM[GA21]*det3_345_023
797  + pM[GA22]*det3_345_013 - pM[GA23]*det3_345_012;
798  const Double_t det4_2345_0124 = pM[GA20]*det3_345_124 - pM[GA21]*det3_345_024
799  + pM[GA22]*det3_345_014 - pM[GA24]*det3_345_012;
800  const Double_t det4_2345_0125 = pM[GA20]*det3_345_125 - pM[GA21]*det3_345_025
801  + pM[GA22]*det3_345_015 - pM[GA25]*det3_345_012;
802  const Double_t det4_2345_0134 = pM[GA20]*det3_345_134 - pM[GA21]*det3_345_034
803  + pM[GA23]*det3_345_014 - pM[GA24]*det3_345_013;
804  const Double_t det4_2345_0135 = pM[GA20]*det3_345_135 - pM[GA21]*det3_345_035
805  + pM[GA23]*det3_345_015 - pM[GA25]*det3_345_013;
806  const Double_t det4_2345_0145 = pM[GA20]*det3_345_145 - pM[GA21]*det3_345_045
807  + pM[GA24]*det3_345_015 - pM[GA25]*det3_345_014;
808  const Double_t det4_2345_0234 = pM[GA20]*det3_345_234 - pM[GA22]*det3_345_034
809  + pM[GA23]*det3_345_024 - pM[GA24]*det3_345_023;
810  const Double_t det4_2345_0235 = pM[GA20]*det3_345_235 - pM[GA22]*det3_345_035
811  + pM[GA23]*det3_345_025 - pM[GA25]*det3_345_023;
812  const Double_t det4_2345_0245 = pM[GA20]*det3_345_245 - pM[GA22]*det3_345_045
813  + pM[GA24]*det3_345_025 - pM[GA25]*det3_345_024;
814  const Double_t det4_2345_0345 = pM[GA20]*det3_345_345 - pM[GA23]*det3_345_045
815  + pM[GA24]*det3_345_035 - pM[GA25]*det3_345_034;
816  const Double_t det4_2345_1234 = pM[GA21]*det3_345_234 - pM[GA22]*det3_345_134
817  + pM[GA23]*det3_345_124 - pM[GA24]*det3_345_123;
818  const Double_t det4_2345_1235 = pM[GA21]*det3_345_235 - pM[GA22]*det3_345_135
819  + pM[GA23]*det3_345_125 - pM[GA25]*det3_345_123;
820  const Double_t det4_2345_1245 = pM[GA21]*det3_345_245 - pM[GA22]*det3_345_145
821  + pM[GA24]*det3_345_125 - pM[GA25]*det3_345_124;
822  const Double_t det4_2345_1345 = pM[GA21]*det3_345_345 - pM[GA23]*det3_345_145
823  + pM[GA24]*det3_345_135 - pM[GA25]*det3_345_134;
824  const Double_t det4_2345_2345 = pM[GA22]*det3_345_345 - pM[GA23]*det3_345_245
825  + pM[GA24]*det3_345_235 - pM[GA25]*det3_345_234;
826 
827  // Find all NECESSGARY 5x5 dets: (36 of them)
828 
829  const Double_t det5_01234_01234 = pM[GA00]*det4_1234_1234 - pM[GA01]*det4_1234_0234
830  + pM[GA02]*det4_1234_0134 - pM[GA03]*det4_1234_0124 + pM[GA04]*det4_1234_0123;
831  const Double_t det5_01234_01235 = pM[GA00]*det4_1234_1235 - pM[GA01]*det4_1234_0235
832  + pM[GA02]*det4_1234_0135 - pM[GA03]*det4_1234_0125 + pM[GA05]*det4_1234_0123;
833  const Double_t det5_01234_01245 = pM[GA00]*det4_1234_1245 - pM[GA01]*det4_1234_0245
834  + pM[GA02]*det4_1234_0145 - pM[GA04]*det4_1234_0125 + pM[GA05]*det4_1234_0124;
835  const Double_t det5_01234_01345 = pM[GA00]*det4_1234_1345 - pM[GA01]*det4_1234_0345
836  + pM[GA03]*det4_1234_0145 - pM[GA04]*det4_1234_0135 + pM[GA05]*det4_1234_0134;
837  const Double_t det5_01234_02345 = pM[GA00]*det4_1234_2345 - pM[GA02]*det4_1234_0345
838  + pM[GA03]*det4_1234_0245 - pM[GA04]*det4_1234_0235 + pM[GA05]*det4_1234_0234;
839  const Double_t det5_01234_12345 = pM[GA01]*det4_1234_2345 - pM[GA02]*det4_1234_1345
840  + pM[GA03]*det4_1234_1245 - pM[GA04]*det4_1234_1235 + pM[GA05]*det4_1234_1234;
841  const Double_t det5_01235_01234 = pM[GA00]*det4_1235_1234 - pM[GA01]*det4_1235_0234
842  + pM[GA02]*det4_1235_0134 - pM[GA03]*det4_1235_0124 + pM[GA04]*det4_1235_0123;
843  const Double_t det5_01235_01235 = pM[GA00]*det4_1235_1235 - pM[GA01]*det4_1235_0235
844  + pM[GA02]*det4_1235_0135 - pM[GA03]*det4_1235_0125 + pM[GA05]*det4_1235_0123;
845  const Double_t det5_01235_01245 = pM[GA00]*det4_1235_1245 - pM[GA01]*det4_1235_0245
846  + pM[GA02]*det4_1235_0145 - pM[GA04]*det4_1235_0125 + pM[GA05]*det4_1235_0124;
847  const Double_t det5_01235_01345 = pM[GA00]*det4_1235_1345 - pM[GA01]*det4_1235_0345
848  + pM[GA03]*det4_1235_0145 - pM[GA04]*det4_1235_0135 + pM[GA05]*det4_1235_0134;
849  const Double_t det5_01235_02345 = pM[GA00]*det4_1235_2345 - pM[GA02]*det4_1235_0345
850  + pM[GA03]*det4_1235_0245 - pM[GA04]*det4_1235_0235 + pM[GA05]*det4_1235_0234;
851  const Double_t det5_01235_12345 = pM[GA01]*det4_1235_2345 - pM[GA02]*det4_1235_1345
852  + pM[GA03]*det4_1235_1245 - pM[GA04]*det4_1235_1235 + pM[GA05]*det4_1235_1234;
853  const Double_t det5_01245_01234 = pM[GA00]*det4_1245_1234 - pM[GA01]*det4_1245_0234
854  + pM[GA02]*det4_1245_0134 - pM[GA03]*det4_1245_0124 + pM[GA04]*det4_1245_0123;
855  const Double_t det5_01245_01235 = pM[GA00]*det4_1245_1235 - pM[GA01]*det4_1245_0235
856  + pM[GA02]*det4_1245_0135 - pM[GA03]*det4_1245_0125 + pM[GA05]*det4_1245_0123;
857  const Double_t det5_01245_01245 = pM[GA00]*det4_1245_1245 - pM[GA01]*det4_1245_0245
858  + pM[GA02]*det4_1245_0145 - pM[GA04]*det4_1245_0125 + pM[GA05]*det4_1245_0124;
859  const Double_t det5_01245_01345 = pM[GA00]*det4_1245_1345 - pM[GA01]*det4_1245_0345
860  + pM[GA03]*det4_1245_0145 - pM[GA04]*det4_1245_0135 + pM[GA05]*det4_1245_0134;
861  const Double_t det5_01245_02345 = pM[GA00]*det4_1245_2345 - pM[GA02]*det4_1245_0345
862  + pM[GA03]*det4_1245_0245 - pM[GA04]*det4_1245_0235 + pM[GA05]*det4_1245_0234;
863  const Double_t det5_01245_12345 = pM[GA01]*det4_1245_2345 - pM[GA02]*det4_1245_1345
864  + pM[GA03]*det4_1245_1245 - pM[GA04]*det4_1245_1235 + pM[GA05]*det4_1245_1234;
865  const Double_t det5_01345_01234 = pM[GA00]*det4_1345_1234 - pM[GA01]*det4_1345_0234
866  + pM[GA02]*det4_1345_0134 - pM[GA03]*det4_1345_0124 + pM[GA04]*det4_1345_0123;
867  const Double_t det5_01345_01235 = pM[GA00]*det4_1345_1235 - pM[GA01]*det4_1345_0235
868  + pM[GA02]*det4_1345_0135 - pM[GA03]*det4_1345_0125 + pM[GA05]*det4_1345_0123;
869  const Double_t det5_01345_01245 = pM[GA00]*det4_1345_1245 - pM[GA01]*det4_1345_0245
870  + pM[GA02]*det4_1345_0145 - pM[GA04]*det4_1345_0125 + pM[GA05]*det4_1345_0124;
871  const Double_t det5_01345_01345 = pM[GA00]*det4_1345_1345 - pM[GA01]*det4_1345_0345
872  + pM[GA03]*det4_1345_0145 - pM[GA04]*det4_1345_0135 + pM[GA05]*det4_1345_0134;
873  const Double_t det5_01345_02345 = pM[GA00]*det4_1345_2345 - pM[GA02]*det4_1345_0345
874  + pM[GA03]*det4_1345_0245 - pM[GA04]*det4_1345_0235 + pM[GA05]*det4_1345_0234;
875  const Double_t det5_01345_12345 = pM[GA01]*det4_1345_2345 - pM[GA02]*det4_1345_1345
876  + pM[GA03]*det4_1345_1245 - pM[GA04]*det4_1345_1235 + pM[GA05]*det4_1345_1234;
877  const Double_t det5_02345_01234 = pM[GA00]*det4_2345_1234 - pM[GA01]*det4_2345_0234
878  + pM[GA02]*det4_2345_0134 - pM[GA03]*det4_2345_0124 + pM[GA04]*det4_2345_0123;
879  const Double_t det5_02345_01235 = pM[GA00]*det4_2345_1235 - pM[GA01]*det4_2345_0235
880  + pM[GA02]*det4_2345_0135 - pM[GA03]*det4_2345_0125 + pM[GA05]*det4_2345_0123;
881  const Double_t det5_02345_01245 = pM[GA00]*det4_2345_1245 - pM[GA01]*det4_2345_0245
882  + pM[GA02]*det4_2345_0145 - pM[GA04]*det4_2345_0125 + pM[GA05]*det4_2345_0124;
883  const Double_t det5_02345_01345 = pM[GA00]*det4_2345_1345 - pM[GA01]*det4_2345_0345
884  + pM[GA03]*det4_2345_0145 - pM[GA04]*det4_2345_0135 + pM[GA05]*det4_2345_0134;
885  const Double_t det5_02345_02345 = pM[GA00]*det4_2345_2345 - pM[GA02]*det4_2345_0345
886  + pM[GA03]*det4_2345_0245 - pM[GA04]*det4_2345_0235 + pM[GA05]*det4_2345_0234;
887  const Double_t det5_02345_12345 = pM[GA01]*det4_2345_2345 - pM[GA02]*det4_2345_1345
888  + pM[GA03]*det4_2345_1245 - pM[GA04]*det4_2345_1235 + pM[GA05]*det4_2345_1234;
889  const Double_t det5_12345_01234 = pM[GA10]*det4_2345_1234 - pM[GA11]*det4_2345_0234
890  + pM[GA12]*det4_2345_0134 - pM[GA13]*det4_2345_0124 + pM[GA14]*det4_2345_0123;
891  const Double_t det5_12345_01235 = pM[GA10]*det4_2345_1235 - pM[GA11]*det4_2345_0235
892  + pM[GA12]*det4_2345_0135 - pM[GA13]*det4_2345_0125 + pM[GA15]*det4_2345_0123;
893  const Double_t det5_12345_01245 = pM[GA10]*det4_2345_1245 - pM[GA11]*det4_2345_0245
894  + pM[GA12]*det4_2345_0145 - pM[GA14]*det4_2345_0125 + pM[GA15]*det4_2345_0124;
895  const Double_t det5_12345_01345 = pM[GA10]*det4_2345_1345 - pM[GA11]*det4_2345_0345
896  + pM[GA13]*det4_2345_0145 - pM[GA14]*det4_2345_0135 + pM[GA15]*det4_2345_0134;
897  const Double_t det5_12345_02345 = pM[GA10]*det4_2345_2345 - pM[GA12]*det4_2345_0345
898  + pM[GA13]*det4_2345_0245 - pM[GA14]*det4_2345_0235 + pM[GA15]*det4_2345_0234;
899  const Double_t det5_12345_12345 = pM[GA11]*det4_2345_2345 - pM[GA12]*det4_2345_1345
900  + pM[GA13]*det4_2345_1245 - pM[GA14]*det4_2345_1235 + pM[GA15]*det4_2345_1234;
901 
902  // Find the determinant
903 
904  const Double_t det = pM[GA00]*det5_12345_12345 - pM[GA01]*det5_12345_02345 + pM[GA02]*det5_12345_01345
905  - pM[GA03]*det5_12345_01245 + pM[GA04]*det5_12345_01235 - pM[GA05]*det5_12345_01234;
906  if (determ)
907  *determ = det;
908 
909  if ( det == 0 ) {
910  Error("Inv6x6","matrix is singular");
911  return kFALSE;
912  }
913 
914  const Double_t oneOverDet = 1.0/det;
915  const Double_t mn1OverDet = - oneOverDet;
916 
917  pM[GA00] = det5_12345_12345*oneOverDet;
918  pM[GA01] = det5_02345_12345*mn1OverDet;
919  pM[GA02] = det5_01345_12345*oneOverDet;
920  pM[GA03] = det5_01245_12345*mn1OverDet;
921  pM[GA04] = det5_01235_12345*oneOverDet;
922  pM[GA05] = det5_01234_12345*mn1OverDet;
923 
924  pM[GA10] = det5_12345_02345*mn1OverDet;
925  pM[GA11] = det5_02345_02345*oneOverDet;
926  pM[GA12] = det5_01345_02345*mn1OverDet;
927  pM[GA13] = det5_01245_02345*oneOverDet;
928  pM[GA14] = det5_01235_02345*mn1OverDet;
929  pM[GA15] = det5_01234_02345*oneOverDet;
930 
931  pM[GA20] = det5_12345_01345*oneOverDet;
932  pM[GA21] = det5_02345_01345*mn1OverDet;
933  pM[GA22] = det5_01345_01345*oneOverDet;
934  pM[GA23] = det5_01245_01345*mn1OverDet;
935  pM[GA24] = det5_01235_01345*oneOverDet;
936  pM[GA25] = det5_01234_01345*mn1OverDet;
937 
938  pM[GA30] = det5_12345_01245*mn1OverDet;
939  pM[GA31] = det5_02345_01245*oneOverDet;
940  pM[GA32] = det5_01345_01245*mn1OverDet;
941  pM[GA33] = det5_01245_01245*oneOverDet;
942  pM[GA34] = det5_01235_01245*mn1OverDet;
943  pM[GA35] = det5_01234_01245*oneOverDet;
944 
945  pM[GA40] = det5_12345_01235*oneOverDet;
946  pM[GA41] = det5_02345_01235*mn1OverDet;
947  pM[GA42] = det5_01345_01235*oneOverDet;
948  pM[GA43] = det5_01245_01235*mn1OverDet;
949  pM[GA44] = det5_01235_01235*oneOverDet;
950  pM[GA45] = det5_01234_01235*mn1OverDet;
951 
952  pM[GA50] = det5_12345_01234*mn1OverDet;
953  pM[GA51] = det5_02345_01234*oneOverDet;
954  pM[GA52] = det5_01345_01234*mn1OverDet;
955  pM[GA53] = det5_01245_01234*oneOverDet;
956  pM[GA54] = det5_01235_01234*mn1OverDet;
957  pM[GA55] = det5_01234_01234*oneOverDet;
958 
959  return kTRUE;
960 }
961 
962 #ifndef ROOT_TMatrixFfwd
963 #include "TMatrixFfwd.h"
964 #endif
965 
966 template Bool_t TMatrixTCramerInv::Inv2x2<Float_t>(TMatrixF&,Double_t*);
967 template Bool_t TMatrixTCramerInv::Inv3x3<Float_t>(TMatrixF&,Double_t*);
968 template Bool_t TMatrixTCramerInv::Inv4x4<Float_t>(TMatrixF&,Double_t*);
969 template Bool_t TMatrixTCramerInv::Inv5x5<Float_t>(TMatrixF&,Double_t*);
970 template Bool_t TMatrixTCramerInv::Inv6x6<Float_t>(TMatrixF&,Double_t*);
971 
972 #ifndef ROOT_TMatrixDfwd
973 #include "TMatrixDfwd.h"
974 #endif
975 
976 template Bool_t TMatrixTCramerInv::Inv2x2<Double_t>(TMatrixD&,Double_t*);
977 template Bool_t TMatrixTCramerInv::Inv3x3<Double_t>(TMatrixD&,Double_t*);
978 template Bool_t TMatrixTCramerInv::Inv4x4<Double_t>(TMatrixD&,Double_t*);
979 template Bool_t TMatrixTCramerInv::Inv5x5<Double_t>(TMatrixD&,Double_t*);
980 template Bool_t TMatrixTCramerInv::Inv6x6<Double_t>(TMatrixD&,Double_t*);
Int_t GetRowLwb() const
Definition: TMatrixTBase.h:132
#define GM00
#define GA13
#define GA52
#define GM30
#define GA25
#define GM20
#define GM12
#define GA34
Bool_t Inv5x5(TMatrixT< Element > &m, Double_t *determ)
#define GA55
#define GM43
#define GA14
#define GA11
#define GF03
#define GM41
#define GM03
#define GF21
#define GA00
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
#define GM34
#define GA42
#define GM14
TLatex * t1
Definition: textangle.C:20
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
#define GM02
Bool_t Inv3x3(TMatrixT< Element > &m, Double_t *determ)
#define GA50
#define GF12
#define GF11
#define GM31
#define GA15
#define GA22
#define GA02
#define GA40
#define GA44
#define GM40
void Error(const char *location, const char *msgfmt,...)
#define GA51
#define GA20
Int_t GetNrows() const
Definition: TMatrixTBase.h:134
#define GM04
#define GM24
#define GM13
#define GA45
#define GF20
#define GM42
#define GA05
#define GM44
TMarker * m
Definition: textangle.C:8
#define GA32
virtual const Element * GetMatrixArray() const
Definition: TMatrixT.h:222
#define GA04
NamespaceImp(TMatrixTCramerInv)
#define GA21
#define GF10
Int_t GetColLwb() const
Definition: TMatrixTBase.h:135
TText * t2
Definition: rootenv.C:28
Bool_t Inv2x2(TMatrixT< Element > &m, Double_t *determ)
#define GA43
#define GM11
#define GA12
#define GA03
double Double_t
Definition: RtypesCore.h:55
#define GM21
#define GF22
Int_t GetNcols() const
Definition: TMatrixTBase.h:137
#define GA24
#define GA41
#define GM01
#define GA30
#define GM33
#define GA23
#define GF32
#define GM22
#define GA01
#define GA33
#define GM10
#define GF30
#define GA53
#define GF01
#define GF13
Bool_t Inv6x6(TMatrixT< Element > &m, Double_t *determ)
#define GA10
#define GM32
#define GA31
#define GA54
Bool_t Inv4x4(TMatrixT< Element > &m, Double_t *determ)
#define GM23
#define GF00
const Bool_t kTRUE
Definition: Rtypes.h:91
#define GF23
#define GA35
#define GF31
#define GF33
#define GF02