Matrix addition

From: Hermann Fuchs <hermann.fuchs_at_meduniwien.ac.at>
Date: Tue, 23 Aug 2011 12:57:57 +0200


Dear Root Users!

In my program I often (a few hundred times) have to add (element wise sum) matrices.
Currently I declare them dynamically using basic c arrays new Int_t**[dimZ] etc...
and add them by looping
for (i...)

	for (j...)
		example[i][j]=example[i][j]+othermatrix[i][j];

Both matrices have the same dimensions for example i=800 j=900.

Would there be any speed gain if I would switch to the TMatrix classes and use the matrix operator A+=B ?

I will only need the adding of the matrices so I suspect there might be a bit of overhead.

What would be the best to use?

Cheers,
Hermann

-- 
-------------
DI Hermann Fuchs
Div. Medical Radiation Physics
Department of Radiotherapy
Med. Univ. Vienna / AKH Vienna
Währinger Gürtel 18-20
A-1090 Wien

Tel.  + 43 / 1 / 40 400 7271
Mail. hermann.fuchs_at_meduniwien.ac.at
Received on Tue Aug 23 2011 - 12:58:08 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 23 2011 - 17:50:01 CEST