<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 2 Jan 2012, at 18:40, Jan Marten Simons wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Sans'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Is there another simple way to do sclices with flex arrays or could this be<span class="Apple-converted-space">&nbsp;</span><br>implemented the same way as in numpy by someone who is more into c++ than<span class="Apple-converted-space">&nbsp;</span><br>myself?<br></span></blockquote><br></div><div>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</div><div><br></div><div>grid.matrix_copy_block(i_row=1, i_column=0, n_rows=1, n_columns=grid.all()[1])</div><div><br></div><div>To get one column, you have the less verbose</div><div><br></div><div>grid.matrix_copy_column</div><div><br></div><div>Adding a grid.matrix_copy_row is a 2 min exercise. Adding proper support of 2d slicing is a few hours work.</div><div><br></div><div>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.</div><div><br></div><div>HtH,</div><div><br></div><div>Luc Bourhis</div><div><br></div><br></body></html>