← Back to team overview

dolfin team mailing list archive

Re: missing LA functionality

 

On Tuesday 23 December 2008 11:16:19 Kent Andre wrote:
> Hi, it seems that when I
> have one GenericVector and one Vector I can
> only add these together, not subtract them.
>
> I'd like to subtract them as well :)
>
> The following illustrate the problem:
>
>
> from dolfin import *
>
>
> mesh = UnitSquare(12,12)
> V = FunctionSpace(mesh, "CG", 1)
> v = TestFunction(V)
> f = Function(V)
> s = Constant(mesh, 1.0)
>
> L = s*v*dx
>
> b = assemble(L)
>
>
> x = b + f.vector()
> x = b - f.vector()

This error was caused by a missing __rsub__ implementation, and should be 
fixed now.

The strange thing is that the function was implemented but it returned 
NotImplemented. This give me a feeling that when I implemented the LA 
interface I excluded it by design. But I cannot think of any case where the 
use of __rsub__ could cause any trouble.

Johan


Follow ups

References