Hi all
>>> from sympy import *
>>> M = Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6] ] )
>>> M.row_del ( 8 ) # any index >= M.rows to be used
>>> print( M )
Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] ) # deletes the last row of Matrix for Index >= M.rows
>>> N = Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6] ] )
>>> N.row_del( -10 )
>>> print( N ) # deletes the last row of Matrix with any `Negative Index`
Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] )
But the output for .row_insert() shows different behavior
>>> M = Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5] ] )
>>> M.row_insert ( 10, Matrix( [ [ 5, 5, 5 ] ] ) )
Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5], [5, 5, 5] ] ) # inserts the row at the very end for Index >= M.rows
>>> N = Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] )
>>> N.row_insert( -10, Matrix( [ [5, 5, 5 ] ] ) )
Matrix( [ [5, 5, 5], [1, 2, 3], [2, 3, 4], [3, 4, 5] ] ) # inserts the row at the very beginning for `Negative Index`
First of all i expected that an IndexError be raised in all cases. Because i think it should follow something like a = [1, 2, 3] and del a[ 10 ] which raises an error.
But even if not error then it should be more consistent with the indices. Is it the way the things are expected to work ?