← Back to team overview

dolfin team mailing list archive

Re: bug in vector summation???

 

Sorry, change to

    s += (*this)(i);

/Anders


On Fri, Sep 15, 2006 at 02:44:35PM +0200, Dag Lindbo wrote:
> I get a compile error...
> 
> uBlasVector.cpp:92: error: no match for 'operator+=' in 's += *((+(i *
> 28u)) + ((const dolfin::uBlasVector*)this))'
> make[4]: *** [uBlasVector.lo] Error 1
> 
> /Dag
> 
> > No wonder, the sum() function in uBlasVector has the following elegant
> > implementation:
> >
> > real uBlasVector::sum() const
> > {
> >   return sum();
> > }
> >
> > :-)
> >
> > Replace with the following (will commit this update shortly):
> >
> > real uBlasVector::sum() const
> > {
> >   // FIXME: Find suitable uBlas call to compute sum
> >   real s = 0.0;
> >   for (uint i = 0; i < size(); i++)
> >     s += (this)[i];
> >   return s;
> > }
> >
> > /Anders
> >
> > On Fri, Sep 15, 2006 at 01:59:42PM +0200, Dag Lindbo wrote:
> >> Hello all,
> >>
> >> I have a possible bug to report in the Vector class. The summation call,
> >> sum(), causes my program to freeze. To test I use this little code
> >>
> >>   Vector vec;
> >>   vec.init(100);
> >>   vec = 1.0;
> >>   vec.disp();         // All seems fine
> >>   real s = vec.sum(); // Does not return. 100% CPU load
> >>
> >> Ideas??
> >>
> >> /Dag Lindbo
> >>
> >> _______________________________________________
> >> DOLFIN-dev mailing list
> >> DOLFIN-dev@xxxxxxxxxx
> >> http://www.fenics.org/mailman/listinfo/dolfin-dev
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> >
> 
> 


References