Hi Vassili,
The memory allocations depend only on the size of the matrix to be decomposed:
// A = fU fSig fV^T
TMatrixD fU; // orthogonal matrix TMatrixD fV; // orthogonal matrix TVectorD fSig; // diagonal of diagonal matrix
Sizes of these three class members are set according to the size of A:
fU.ResizeTo(nrows,nrows);
fSig.ResizeTo(ncols);
fV.ResizeTo(nrows,ncols);
So if you are decomposing matrices with the same sizes in a loop, it is most efficient to do
TDecompSVD svd(nrows,ncols) outside the loop and a SetMatrix in the loop . (SetMatrix checks of course whether it has to re-adjust the class members ).
Eddy
> Dear ROOTers,
>
> I'm wondering whether in the current implementation the TDecompSVD
> structure depends only on the dimensions of the matrix to decompose,
> or
> on the matrix content as well (I could imagine an implementation
> where
> all-zero rows of a matrix are removed while constructing the
> decomposition)?.. I mean, if I'm always working with matrices of the
> same dimension, may I with reuse of a TDecompSVD object with
> TDecompSVD.SetMatrix(...) to avoid memory allocations/deallocations?
> Does the reuse make a sense, doesn't TDecompSVD.Solve(...) make
> intensive memory allocations/deallocations? Sorry for not trying to
> dig
> into the code by myself, I think I can get answers quicker here :)
>
> Regards,
>
> Vassili
>
>
Received on Thu Feb 07 2008 - 19:07:02 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 07 2008 - 23:50:01 CET