← Back to team overview

dolfin team mailing list archive

numpy ndarray from/to dolfin matrix

 

Just to add, numpy.array is of type of numpy.ndarray, I don't
understand why this shouldn't work:

a = numpy.array([3., 4., 5.])
m = dolfin.Matrix()
m.set(a, 1, 3)

Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/usr/lib/python2.5/site-packages/dolfin/cpp.py", line 4434, in set
   return _cpp.Matrix_set(*args)
TypeError: Numpy array expected


2009/1/14 A Navaei <axnavaei@xxxxxxxxx>:
- Hide quoted text -
> Hi,
>
> Is it possible to convert numpy ndarray from/to dolfin matrix? It
> seems dolfin matrix only accepts numpy array while ndarray is a better
> choice.
>
>
> -Ali
>


Follow ups