With the current Python interface, it is that it is relatively cumbersome to convert between tensors and Numpy arrays. This is somewhat worse for states, whose use may increase in the future because there will be Python-only functionality, e.g., with respect to plotting.
There should be some conversion functions that can directly map a state to a Numpy array. If there is any improvement possible for the conversion between tensors and numpy arrays, that would be fine as well.
I only did some very minimalistic changes here and improved the conversion from Numpy arrays / python buffer protocol. In general, these are mostly not that helpful, though, because in most cases you also need some input (grids), which makes the whole exercise a bit annoying.
The other direction, from tensors to Numpy arrays is a bit tricky, because you would need to actually register a specific type conversion that I frankly feel not up to right now. This has been offloaded into a separate issue [#208].
Diff:
Diff:
Related
Tickets: #208
Diff:
Related
Tickets: #208