# Re:[ROOT]problem matrix invertion

From: Edmond Offermann (edmondoffermann@yahoo.com)
Date: Tue Dec 07 2004 - 19:49:49 MET

```Hi,

Just to clarify a bit more . In the old linear algebra package, the
matrix was automatically normalized if it was symmetric !
Nicolas' matrix turns out to be symmetric . The normalization
procedure applied is that of procedure NormByDiag() .

Since now we have seperate classes for symmetric and non-symmetric
classes, we can and should not apply anymore this special
normalization to the matrix in TMatrixD::Invert() . It is not
apriori clear how one wants to normalize a general matrix, it is
left as the users responsibility .

The determinant of Nicolas matrix is correctly calculated, but now
we warn the user that it is overflowing (>2^52) and return a value
of zero . This last point leads to a lot of confussion/grieve so I will
propose a patch that will return the calculated determinant and
just warn that it overflowed .

Eddy

--- PRODUIT Nicolas <Nicolas.Produit@obs.unige.ch> wrote:

> Hi,
> working offline with Edmond we have solved my problem.
> The problem was that ROOT 4.0.8 was not able to
> invert a matrix that ROOT 3.4.2 was able to invert.
> My matrix had huge determinant (1E53) that caused problem
> to ROOT 4.0.8 when determinant calculation was explicitly asked.
> I used determinant computation just to catch singularity of
> the matrix.
> Edmond show me better ways of testing for singularity.
> Reconditioning my matrix by dividing every element by the maximum
> diagonal element make it more manageable for determinant
> computation and now
> both version of ROOT give identical results on this better behaved
> matrix.
>
> For those interested this is the matrix that new ROOT has problem
> to determine determinant:
>
> Matrix 21x21 is as follows
>
>       |        0  |        1  |        2  |        3  |        4  |
> ------------------------------------------------------------------
>     0 |        833         475       474.7       154.2       490.4
>     1 |        475       947.1       538.4       155.1       560.1
>     2 |      474.7       538.4        1016       148.9       601.5
>     3 |      154.2       155.1       148.9       250.7       169.4
>     4 |      490.4       560.1       601.5       169.4        1314
>     5 |      489.2       556.5       596.4       155.1       771.8
>     6 |      481.1       549.4       588.4       155.1       760.9
>     7 |      475.5       532.8       552.2       159.7       571.6
>     8 |      476.5       543.4       584.3       156.6       772.7
>     9 |      394.4       461.4       504.8       70.02       661.3
>    10 |        474       537.3       575.8       152.8         742
>    11 |      460.4       525.7       564.5       146.2       755.7
>    12 |      276.7       319.8       353.9       22.09       478.5
>    13 |          0       16.61       52.61           0       171.2
>    14 |      101.4       149.6         182           0       292.6
>    15 |      246.4       277.8       299.4        77.6       370.5
>    16 |          0           0           0           0       58.85
>    17 |          0           0           0           0       39.23
>    18 |          0           0           0           0       42.14
>    19 |      17.77       43.23       65.38           0       133.9
>    20 |      970.8        1107        1191       315.2        1545
>
>
>       |        5  |        6  |        7  |        8  |        9  |
> ------------------------------------------------------------------
>     0 |      489.2       481.1       475.5       476.5       394.4
>     1 |      556.5       549.4       532.8       543.4       461.4
>     2 |      596.4       588.4       552.2       584.3       504.8
>     3 |      155.1       155.1       159.7       156.6       70.02
>     4 |      771.8       760.9       571.6       772.7       661.3
>     5 |       1365       781.8       567.4       792.9       703.6
>     6 |      781.8        1350       560.1       783.2       698.9
>     7 |      567.4       560.1       944.9       554.1       471.5
>     8 |      792.9       783.2       554.1        1342       711.2
>     9 |      703.6       698.9       471.5       711.2        1189
>    10 |      758.5       749.7       548.8       761.5       678.1
>    11 |      773.6       762.8       547.1       777.8       696.4
>    12 |      504.4       498.4       330.5       505.9       503.9
>    13 |      189.7       188.2       25.56       203.6         206
>    14 |      316.5       309.9       162.1       316.7       324.3
>    15 |      378.4       374.3       273.6       383.1       341.6
>    16 |      65.48       58.62           0       74.83       74.88
>    17 |      49.28       45.25           0       52.31       54.38
>    18 |      49.67       46.48           0        56.8        57.6
>    19 |        135       132.8       56.23       142.2       140.8
>    20 |       1581        1563        1131        1586        1409
>
>
>       |       10  |       11  |       12  |       13  |       14  |
> ------------------------------------------------------------------
>     0 |        474       460.4       276.7           0       101.4
>     1 |      537.3       525.7       319.8       16.61       149.6
>     2 |      575.8       564.5       353.9       52.61         182
>     3 |      152.8       146.2       22.09           0           0
>     4 |        742       755.7       478.5       171.2       292.6
>     5 |      758.5       773.6       504.4       189.7       316.5
>     6 |      749.7       762.8       498.4       188.2       309.9
>     7 |      548.8       547.1       330.5       25.56       162.1
>     8 |      761.5       777.8       505.9       203.6       316.7
>     9 |      678.1       696.4       503.9         206       324.3
>    10 |       1295       756.2       505.3         199       278.9
>    11 |      756.2        1304       508.8       201.4       319.3
>    12 |      505.3       508.8       844.5       176.1         315
>    13 |        199       201.4       176.1         319       171.6
>    14 |      278.9       319.3         315       171.6       530.7
>    15 |      382.5       375.3       317.3       120.6       230.8
>    16 |      67.16        75.5       78.26       68.94        77.3
>    17 |      45.89       55.56       51.24        49.8       57.54
>    18 |      46.73       57.49        55.5       51.34       60.05
>    19 |      127.7       144.1       142.4       101.3       149.8
>    20 |       1525        1548        1010       390.6         630
>
>
>       |       15  |       16  |       17  |       18  |       19  |
> ------------------------------------------------------------------
>     0 |      246.4           0           0           0       17.77
>     1 |      277.8           0           0           0       43.23
>     2 |      299.4           0           0           0       65.38
>     3 |       77.6           0           0           0           0
>     4 |      370.5       58.85       39.23       42.14       133.9
>     5 |      378.4       65.48       49.28       49.67         135
>     6 |      374.3       58.62       45.25       46.48       132.8
>     7 |      273.6           0           0           0       56.23
>     8 |      383.1       74.83       52.31        56.8       142.2
>     9 |      341.6       74.88       54.38        57.6       140.8
>    10 |      382.5       67.16       45.89       46.73       127.7
>    11 |      375.3        75.5       55.56       57.49       144.1
>    12 |      317.3       78.26       51.24        55.5       142.4
>    13 |      120.6       68.94        49.8       51.34       101.3
>    14 |      230.8        77.3       57.54       60.05       149.8
>    15 |      657.2       64.84       44.36          51         144
>    16 |      64.84       110.4       52.59          56        56.9
>    17 |      44.36       52.59        79.1       73.07       44.16
>    18 |         51          56       73.07       83.99       45.74
>    19 |        144        56.9       44.16       45.74       228.7
>    20 |        774       143.4       103.2         108       281.6
>
>
>       |       20  |
> ------------------------------------------------------------------
>     0 |      970.8
>     1 |       1107
>     2 |       1191
>     3 |      315.2
>     4 |       1545
>     5 |       1581
>     6 |       1563
>     7 |       1131
>     8 |       1586
>     9 |       1409
>    10 |       1525
>    11 |       1548
>    12 |       1010
>    13 |      390.6
>    14 |        630
>    15 |        774
>    16 |      143.4
>    17 |      103.2
>    18 |        108
>    19 |      281.6
>    20 |       3168
>
> determinant
> (as computed by ROOT 3)
> 136908227115674077978030740804195813377898749408313344.000000
>
>
>
> Thanks
>
> --
> Nicolas Produit
> INTEGRAL Science Data Center    Phone:  +41 22 950 91 40
> 16, Chemin d'Ecogia             Fax:    +41 22 950 91 33
> CH-1290 Versoix                 www:    http://isdc.unige.ch/~produit
> Phone after 10 Dec 2004:  +41 22 379 21 40
>
>
```

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET