-from sage.structure.element import is_Matrix
-
def _scale(x, alpha):
r"""
Scale the vector, matrix, or cartesian-product-of-those-things
# because vectors can only contain ring elements as entries.
return x.to_vector().list()
- if is_Matrix(x):
+ from sage.structure.element import Matrix
+ if isinstance(x, Matrix):
# This sucks, but for performance reasons we don't want to
# call _all2list recursively on the contents of a matrix
# when we don't have to (they only contain ring elements