> > > For example, I have such fragment:
> > >                  for (j = 0; j < length; j++) {
> > >                  
> > >                          for (i = ip[j]; i <= ip[j+1]-1; i++) {
> > >                          
> > >                                  b[ia[i]] = b[ia[i]] + a[i]*x[j];
> > >                          
> > >                          }
> > >                  
> > >                  }
> > > 
> > > And I want to collect information only about array /b/. How can this be
> > > done?
> > 
> > Short answer is, like this
> > 
> >       for (j = 0; j < length; j++) {
> >       
> >               for (i = ip[j]; i <= ip[j+1]-1; i++) {
> >               
> >                       long ia_i = ia[i];
> >                       double tmp = a[i] * x[j];  // or whatever type it
> >                       is b[ia_i] += tmp;
> >               
> >               }
> >       
> >       }
> 

The second version might be faster too.  For the compiler to transform
the first version into the second version will require a lot of praying
to the gods of Common Subexpression Elimination and Alias Analysis.

J

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to