Hello
I want to extract non-zero elements from uBLAS matrices, as done here with python, dolfin-version 1.4.
However, when i do
r, c, v = A.data()
the returned list v contain also zero elements.
Below is an example with explicit test. Why is e.g. A[0,5] returned, yet it is zero?
What am i missing?
Thanks!
from dolfin import *
from numpy import set_printoptions
set_printoptions(linewidth=200)
parameters["linear_algebra_backend"] = 'uBLAS'
mesh = UnitSquareMesh(3, 3)
V = FunctionSpace(mesh, 'Lagrange', 1)
u = TrialFunction(V)
v = TestFunction(V)
a = inner(nabla_grad(u), nabla_grad(v))*dx
A = assemble(a)
r, c, v = A.data()
print A.array()
print "C", c
print "R", r
print "V", v
if A.array()[0, 5] == 0:
print "is zero"
else:
print "is non-zero"