[cctbxbb] Inconsistency between numpy and flex (sclice notation)
luc_j_bourhis at mac.com
Mon Jan 2 10:41:27 PST 2012
On 2 Jan 2012, at 18:40, Jan Marten Simons wrote:
> Is there another simple way to do sclices with flex arrays or could this be
> implemented the same way as in numpy by someone who is more into c++ than
This has been on my todo list with a low priority for a long while! At the moment, I can only think of the following to get one row of the matrix
grid.matrix_copy_block(i_row=1, i_column=0, n_rows=1, n_columns=grid.all())
To get one column, you have the less verbose
Adding a grid.matrix_copy_row is a 2 min exercise. Adding proper support of 2d slicing is a few hours work.
Note that contrary to numpy, those methods copy the row/column into a new array. And that when 2d slicing will get implemented into the cctbx, grid[1,:] will also return a new array instead of a mere proxy to the elements of grid, as it is the philosophy of the flex arrays.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cctbxbb