multiplication of a Vector by a scalar modifies the vector in place.

Issue #689 invalid
David Ham created an issue

Using the following code:

from fenics import *
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, "CG", 1)
f = interpolate(Constant(1), V)
f_vec = f.vector()
print (f_vec*2).array()

one discovers that f_vec now has the value 2. This is at a minimum a really horrible abuse of notation (* really should not modify its arguments, that's what *= is for).

Comments (5)

  1. Log in to comment