#8389: Sage eats all memory trying to evaluate MatrixSpace(QQ, 2)['x']
---------------------------+------------------------------------------------
   Reporter:  mmezzarobba  |       Owner:  AlexGhitza
       Type:  defect       |      Status:  new       
   Priority:  major        |   Milestone:  sage-4.4  
  Component:  algebra      |    Keywords:            
     Author:               |    Upstream:  N/A       
   Reviewer:               |      Merged:            
Work_issues:               |  
---------------------------+------------------------------------------------
Description changed by mmezzarobba:

Old description:

> This makes Sage eat all available memory until it gets interrupted:
>
> {{{
> $ ./sage
> ----------------------------------------------------------------------
> | Sage Version 4.3.3, Release Date: 2010-02-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: MatrixSpace(QQ, 2)['x']
> ^C---------------------------------------------------------------------------
> KeyboardInterrupt                         Traceback (most recent call
> last)
>
> /home/marc/co/sage-4.3.3/<ipython console> in <module>()
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__getitem__ (sage/structure/parent.c:7653)()
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/structure/parent.so in
> sage.structure.parent.Parent._list_from_iterator_cached
> (sage/structure/parent.c:7061)()
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/matrix/matrix_space.pyc in __iter__(self)
>     792             while True:
>     793                 for iv in
> sage.combinat.integer_vector.IntegerVectors(weight, number_of_entries):
> --> 794                     yield self(entries=[base_elements[i] for i in
> iv], rows=True)
>     795
>     796                 weight += 1
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/matrix/matrix_space.pyc in __call__(self, entries, coerce,
> copy, rows)
>     393             return self(entries.matrix(), copy=False)
>     394
> --> 395         return self.matrix(entries, copy=copy, coerce=coerce,
> rows=rows)
>     396
>     397     def change_ring(self, R):
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/matrix/matrix_space.pyc in matrix(self, x, coerce, copy,
> rows)
>    1068             if isinstance(x[0], list):
>    1069                 x = sum(x,[])
> -> 1070             elif hasattr(x[0], "is_vector"): # TODO: is this the
> best way to test that?
>    1071                 e = []
>    1072                 for v in x:
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/structure/element.so in
> sage.structure.element.Element.__getattr__
> (sage/structure/element.c:2726)()
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/rings/ring.so in sage.rings.ring.Field.category
> (sage/rings/ring.c:8675)()
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/misc/classcall_metaclass.pyc in __call__(cls, *args,
> **options)
>     114             return cls
>     115
> --> 116     def __call__(cls, *args, **options):
>     117         """
>     118         This method implements ``cls(<some arguments>)``.
>
> /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
> packages/sage/interfaces/get_sigs.pyc in my_sigint(x, n)
>       7
>       8 def my_sigint(x, n):
> ----> 9     raise KeyboardInterrupt
>      10
>      11 def my_sigfpe(x, n):
> }}}
>
> Note that `MatrixSpace(QQ, 2)['x']` is not supposed to ''work'', since
>
> {{{
> Definition:     PolynomialRing [...]
> Docstring:
>        [...]
>        INPUT:
>
>        * ``base_ring`` -- a commutative ring
> }}}

New description:

 This makes Sage eat all available memory until it gets interrupted:

 {{{
 $ ./sage
 ----------------------------------------------------------------------
 | Sage Version 4.3.3, Release Date: 2010-02-21                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 sage: MatrixSpace(QQ, 2)['x']
 ^C---------------------------------------------------------------------------
 KeyboardInterrupt                         Traceback (most recent call
 last)

 /home/marc/co/sage-4.3.3/<ipython console> in <module>()

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.Parent.__getitem__ (sage/structure/parent.c:7653)()

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.Parent._list_from_iterator_cached
 (sage/structure/parent.c:7061)()

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/matrix/matrix_space.pyc in __iter__(self)
     792             while True:
     793                 for iv in
 sage.combinat.integer_vector.IntegerVectors(weight, number_of_entries):
 --> 794                     yield self(entries=[base_elements[i] for i in
 iv], rows=True)
     795
     796                 weight += 1

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/matrix/matrix_space.pyc in __call__(self, entries, coerce,
 copy, rows)
     393             return self(entries.matrix(), copy=False)
     394
 --> 395         return self.matrix(entries, copy=copy, coerce=coerce,
 rows=rows)
     396
     397     def change_ring(self, R):

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/matrix/matrix_space.pyc in matrix(self, x, coerce, copy,
 rows)
    1068             if isinstance(x[0], list):
    1069                 x = sum(x,[])
 -> 1070             elif hasattr(x[0], "is_vector"): # TODO: is this the
 best way to test that?
    1071                 e = []
    1072                 for v in x:

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/structure/element.so in
 sage.structure.element.Element.__getattr__
 (sage/structure/element.c:2726)()

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/rings/ring.so in sage.rings.ring.Field.category
 (sage/rings/ring.c:8675)()

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/misc/classcall_metaclass.pyc in __call__(cls, *args,
 **options)
     114             return cls
     115
 --> 116     def __call__(cls, *args, **options):
     117         """
     118         This method implements ``cls(<some arguments>)``.

 /home/marc/co/sage-4.3.3/local/lib/python2.6/site-
 packages/sage/interfaces/get_sigs.pyc in my_sigint(x, n)
       7
       8 def my_sigint(x, n):
 ----> 9     raise KeyboardInterrupt
      10
      11 def my_sigfpe(x, n):
 }}}

 Note that `MatrixSpace(QQ, 2)['x']` is not supposed to ''work'', since

 {{{
 Definition:     PolynomialRing [...]
 Docstring:
        [...]
        INPUT:

        * ``base_ring`` -- a commutative ring
 }}}

 (Edit :)  Or is it?  The docstring of
 `sage.rings.polynomial.polynomial_ring` says:

 {{{
 Sage implements sparse and dense polynomials over commutative and
 non-commutative rings.
 }}}

 and contains he following test:

 {{{
     sage: A.<i,j,k> = QuaternionAlgebra(QQ, -1,-1)
     sage: R.<w> = PolynomialRing(A,sparse=True)
 }}}

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8389#comment:1>
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 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.

Reply via email to