"feature" of TMatrixDSym

Dear all,
I have noticed the following, using the TMatrixDSym class: the use of
the operator () can break the symmetry of the matrix, for example:
(ROOT 5.10/00 on Linux)

TMatrixDSym A(5);
A(3,2)=1;
printf("Now the symmetric element is: %e\n", A(2,3));
// the output is 0 !?
printf("Is A symmetric? %d\n",A.IsSymmetric());
// the output is 1 !?

From my point of view this seems a bit odd… Moreover on

root.cern.ch/root/html/TMatrixDSym.html

the following is written:

Something like this is described on the documentation (pag.246):

but in this case I am not doing any particular matrix view, but simply an assignment.
Is this a feature of TMatrixDSym or am I simply doing something wrong?
Best regards

Luigi

Hi Luigi,

Operators (i,j) and [i][j] will change the value at position i,j
without updating j,i . I would not know how to do that …

The class desciption of TMatrixTSym:

is supposed to tell the user that even for a symmetric matrix both
positions i,j and j,i are used and calculated (which most of the time
means copied from i,j to j,i ) .

The documentation will be updated mentioning besides the
matrix views (like TMatrixTRow/Column/Sub) also the operators
and () .

Eddy

Dear Eddy,
thank you for the quick reply.
Now I understand your point, i.e. you cannot have operator () update both i,j and j,i elements at the same time with the current implementation, that is practically a standard TMatrixT.
From this point of view an implementation where only the upper triangle is stored/used would be needed I suppose (but maybe it would be very inefficient).

Apart from updating the pdf documentation, would it be possible to clearly describe this behaviour of TMatrix?Sym also into the “Class Description” of the HTML documentation?

Regards
Luigi

Luigi,

the template package SMatrix contains an implementatioon for symmetric
matrices where only the upper/lower triangula part is stored.

see seal.web.cern.ch/seal/MathLibs/S … index.html
for more information

If you have matrix of smaller size (< 10), is very efficient and performances are almost as good as in a normal matrix

Ciao

Lorenzo