#17124: Matrix constructor broken for symmetric function rings and 1-column
matrices
--------------------------+------------------------------------------------
   Reporter:  darij       |            Owner:
       Type:  defect      |           Status:  new
   Priority:  major       |        Milestone:  sage-6.4
  Component:  linear      |         Keywords:  matrix, symmetric functions,
  algebra                 |          Authors:
  Merged in:              |  Report Upstream:  N/A
  Reviewers:              |           Branch:
Work issues:              |     Dependencies:
     Commit:              |
   Stopgaps:              |
--------------------------+------------------------------------------------
 {{{
 sage: Sym = SymmetricFunctions(QQ); Sym.inject_shorthands()
 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/combinat/sf/sf.py:1198: RuntimeWarning: redefining global
 value `e`
   inject_variable(shorthand, getattr(self, shorthand)())
 sage: Matrix(h, [[h[1]], [h[2]]])
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-2-e73595c500f3> in <module>()
 ----> 1 Matrix(h, [[h[Integer(1)]], [h[Integer(2)]]])

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
     727             ring = rings.ZZ
     728
 --> 729     return matrix_space.MatrixSpace(ring, nrows, ncols,
 sparse=sparse)(entries)
     730
     731

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_space.pyc in __call__(self, entries, coerce,
 copy, sparse)
     468             Full MatrixSpace of 3 by 5 dense matrices over Integer
 Ring!
     469         """
 --> 470         return self.matrix(entries, coerce, copy)
     471
     472     def change_ring(self, R):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_space.pyc in matrix(self, x, coerce, copy)
    1358                                       copy=False, coerce=coerce)
    1359                         else:
 -> 1360                             return MC(self, new_x, copy=False,
 coerce=coerce)
    1361                     except TypeError:
    1362                         pass

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_generic_dense.so in
 sage.matrix.matrix_generic_dense.Matrix_generic_dense.__init__
 (build/cythonized/sage/matrix/matrix_generic_dense.c:2850)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
 (build/cythonized/sage/structure/parent.c:9603)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (build/cythonized/sage/structure/coerce_maps.c:4256)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (build/cythonized/sage/structure/coerce_maps.c:4163)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/combinat/sf/classical.pyc in _element_constructor_(self, x)
     299         # Elements of the base ring #
     300         #############################
 --> 301         elif x.parent() is R:
     302             return eclass(self,
 {sage.combinat.partition.Partition([]):x})
     303

 AttributeError: 'tuple' object has no attribute 'parent'
 }}}

 Using the generic parent doesn't help either:

 {{{
 sage: Matrix(Sym, [[h[1]], [h[2]]])
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-3-9515a5c3ba14> in <module>()
 ----> 1 Matrix(Sym, [[h[Integer(1)]], [h[Integer(2)]]])

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
     727             ring = rings.ZZ
     728
 --> 729     return matrix_space.MatrixSpace(ring, nrows, ncols,
 sparse=sparse)(entries)
     730
     731

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_space.pyc in __call__(self, entries, coerce,
 copy, sparse)
     468             Full MatrixSpace of 3 by 5 dense matrices over Integer
 Ring!
     469         """
 --> 470         return self.matrix(entries, coerce, copy)
     471
     472     def change_ring(self, R):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_space.pyc in matrix(self, x, coerce, copy)
    1358                                       copy=False, coerce=coerce)
    1359                         else:
 -> 1360                             return MC(self, new_x, copy=False,
 coerce=coerce)
    1361                     except TypeError:
    1362                         pass

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/matrix/matrix_generic_dense.so in
 sage.matrix.matrix_generic_dense.Matrix_generic_dense.__init__
 (build/cythonized/sage/matrix/matrix_generic_dense.c:2850)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
 (build/cythonized/sage/structure/parent.c:9603)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (build/cythonized/sage/structure/coerce_maps.c:4256)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (build/cythonized/sage/structure/coerce_maps.c:4163)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/facade_sets.pyc in _element_constructor_(self,
 element)
      99                     except Exception:
     100                         pass
 --> 101             raise ValueError("Can't coerce `%s` in any parent `%s`
 is a facade for"%(element, self))
     102
     103         def facade_for(self):

 ValueError: Can't coerce `([1], 1)` in any parent `Symmetric Functions
 over Rational Field` is a facade for
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/17124>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to