Changes between Initial Version and Version 1 of Ticket #28882, comment 11


Ignore:
Timestamp:
02/26/20 21:19:32 (20 months ago)
Author:
jhpalmieri
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28882, comment 11

    initial v1  
    1 Matrix spaces can be created using the keyword `sparse`, with `False` the default, and you can recover this value using `M.is_sparse()`. So you should call `diagonal_matrix` with the argument `sparse=self.is_sparse()`.
     1Matrix spaces can be created using the keyword `sparse`, with `False` the default, and you can recover this value using `M.is_sparse()`. So you should call `diagonal_matrix` with the argument `sparse=self.is_sparse()`:
     2{{{
     3#!diff
     4diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py
     5index b4cb724e3b..3712806364 100644
     6--- a/src/sage/matrix/matrix_space.py
     7+++ b/src/sage/matrix/matrix_space.py
     8@@ -1600,7 +1600,7 @@ class MatrixSpace(UniqueRepresentation, Parent):
     9         """
     10         if self.__nrows != self.__ncols:
     11             raise TypeError("diagonal matrix must be square")
     12-        A = sage.matrix.special.diagonal_matrix(self.base_ring(), self.dims()[0], entries)
     13+        A = sage.matrix.special.diagonal_matrix(self.base_ring(), self.dims()[0], entries, sparse=self.is_sparse())
     14         A.set_immutable()
     15         return A
     16
     17}}}
    218
    319Why make it immutable by default?