I’m writing a function in Sage that should work in different way for vectors and matrices.
I can not use isinstance function because type of vector or matrix depends on the type of the elements:
sage: type(matrix([[1]]))
<type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
sage: type(matrix([[i]]))
<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
What is the best way to distinguish vectors and matrices?
The solution was accidentally found while trying to find definition
matrix.dimin the Sage source.