#5032: dividing a sparse matrix by a scalar gives a dense matrix, but
multiplying
gives a sparse one
----------------------------+-----------------------------------------------
Reporter: was | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-3.3
Component: linear algebra | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by robertwb):
This is because it creates the matrix space over the fraction field when
division is done, and I agree that it is a bug that the sparce flag
doesn't get passed on. In contrast
{{{
sage: A = matrix(QQ, 2, [1..4], sparse=True)
sage: type(A)
<type 'sage.matrix.matrix_rational_sparse.Matrix_rational_sparse'>
sage: type(A/1)
<type 'sage.matrix.matrix_rational_sparse.Matrix_rational_sparse'>
}}}
What needs to change is
{{{
File: /Users/robert/sage/sage-3.1.3/local/lib/python2.5/site-
packages/sage/matrix/matrix_space.py
Definition: MS.construction(self)
Source:
def construction(self):
from sage.categories.pushout import MatrixFunctor
return MatrixFunctor(self.__nrows, self.__ncols), self.base_ring()
}}}
It should read
{{{
return MatrixFunctor(self.__nrows, self.__ncols,
is_sparse=self.is_sparse), self.base_ring()
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5032#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---