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