This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

AttributeError: 'Matrix' object has no attribute 'set_diagonal'

+1 vote

Hi,

I have this piece of code that was provided on this forum:

form = inner(u, v)*dx
I = assemble(form)
I.zero()
I.set_diagonal(interpolate(Constant(1), V).vector())

But when I try to run it, it returns the following error:

AttributeError: 'Matrix' object has no attribute 'set_diagonal'

though it seems to exist (see here)

Did the name of that method change?

Thanks a lot!
Vincent

asked Oct 3, 2014 by V_L FEniCS User (4,440 points)

Hi, are you using the right version? Your code works fine with DOLFIN 1.4.0 and 1.4.0+. I only get the AttributeError with 1.3.0.

it worked after I updated my version to 1.4

thanks a lot!

1 Answer

+1 vote
 
Best answer

`GenericMatrix::set_diagonal' is available in DOLFIN version 1.4 and later.

answered Nov 5, 2014 by Garth N. Wells FEniCS Expert (35,930 points)
selected Nov 5, 2014 by V_L
...