![]() |
Blitz Support : |
From: Olivier Saut (novocaine_at_[hidden])
Date: 2004-07-15 08:20:20
Xavier WARIN(Compte LOCAL) - I23 wrote:
> Hi Olivier,
Salut Xavier!
>
> Which compiler do you use ? on which OS? Which option do you use ?
gcc 3.3 on FreeBSD (-current). I don't use -DBZ_DZBEBUG but compile with
-O2.
> An obvious problem : you always create a new objet D that you fill in
> and then copy (return D) : that's very slow. You could perhaps create
> your object outside the class and give a reference to it as an
> argument :
> void product(const dipolarMatrix & A, const dipolarMatrix &B,
> dipolarMatrix & D)
> Another problem : you'd better write :
> for(int i=0; i<5; ++i)
> for(int j=0; j<5; ++j)
> {
> complex<double> x =0;
> for(int p=0; p<5; ++p)
> x +=A(i,p)*B(p,j);
> D(i,j) = x ;
> }
> I would interested in knowing the improvement with my suggestions
Your suggestions result in a 6% speed improvement (which means hours of
computation time saved). I will try to investigate a little more to find
bottlenecks as this is probably not related to Blitz++.
Thanks a lot!
- Olivier