dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #15305
Re: [Bug 427047] Re: Vector indexing in Python with NumPy indices
> Works now!
>
> Now if only I could also get values from a vector directly from a
> Python list or Python array of numpy.uint32... :-)
>
> This fails:
>
> values = x[dofs]
> values = x[numpy.array(dofs)]
>
> But this works:
>
> values = [x[dof] for dof in dofs]
>
> dofs is a Python list of numpy.uint32.
Try now...
numpy c-api is not fun...
Feel free to close the bug if it works.
Johan
--
Vector indexing in Python with NumPy indices
https://bugs.launchpad.net/bugs/427047
You received this bug notification because you are subscribed to DOLFIN.
Status in DOLFIN: New
Bug description:
The following breaks:
import dolfin, numpy
x = Vector(10)
print x[numpy.int32(0)]
print x[numpy.int64(0)]
print x[numpy.array((0, 1), dtype='I')
The typechecks in la_post.i looks like they can be expanded. (I tried it myself but couldn't get it working correctly.)
Follow ups
References