There is no fast way to do that right now. One could easily add code
to SAGE_ROOT/devel/sage/sage/matrix/matrix_integer_sparse.pyx that
would provide blazingly fast deletion of a row, and reasonably fast
deletion of a column. Of course it would be better to implement
arbitrary slicing in some optimized way in matrix_integer_sparse.pyx.
I hope somebody does so.
William
Just looking at the generic code, it seems that it goes through each and
every index position in the slice, setting the new matrix entry to the
old one. This is obviously the wrong thing to do for sparse matrices,
and can likely trivially be made faster. I think all you may have to do
is override the matrix_from_rows_and_columns for sparse matrices.
Jason
You might fold your functionality into matrix_from_rows_and_columns.
That way slicing will automatically use it.
Maybe you could intelligently guess from the rows and columns requested
whether it is faster to just copy the matrix, then delete some
rows/columns, or to build the new matrix up. For example, if I'm asking
for every row and column in the matrix except one, almost surely it is
faster to copy the dictionary and delete the appropriate row/column keys.
Then again, I can see the advantage of just having a delete_rows or
delete_columns method; it's definitely clear what you are doing.
Jason