← Back to team overview

dolfin team mailing list archive

Re: Vector interface changes

 

On Mon, Mar 10, 2008 at 08:35:52PM +0100, Dag Lindbo wrote:
> > 2008/3/10, Andy Ray Terrel <aterrel@xxxxxxxxxxxx>:
> >> I was going back and updating some older code and I found an undesirable
> >>  vector interface change for some of my code.   It use to be that Vector
> >>  was just a typedef to the particular vector that was installed (either
> >>  PETSc or uBlas), and the '+' and '*' operator was overloaded in each of
> >>  these. Now it looks like there is some attempts at making a smarter
> >>  wrapper and the '+' and '*' operators are no longer overloaded for the
> >>  Vector Class.  For example the code below works if you replace Vector
> >>  with either PETScVector or uBlasVector, but not as is.  Is this the way
> >>  the current implementation is meant to be, a bug, or am I missing
> >>  something obvious here?
> >
> > It's just not added to the new interfaces yet.
> >
> 
> Sacrificing a bit of beauty, one can do
> 
> iter.vec() = test.vec() + 2*one.vec();
> 
> This should work for both uBLAS or PETSc, right?
> 
> /Dag

Yes, I think so.

The plan is to support linear algebra (!) for vectors and matrices in
a while, both in C++ and Python.

(But using it should be discouraged. You can write many if not all
algorithms for solving PDEs without needing to add vectors and
matrices.)

-- 
Anders


References