#18979: avoid Maxima on creation of symbolic matrices
-------------------------+-------------------------------------------------
       Reporter:  rws    |        Owner:
           Type:         |       Status:  needs_work
  defect                 |    Milestone:  sage-6.9
       Priority:  major  |   Resolution:
      Component:         |    Merged in:
  linear algebra         |    Reviewers:
       Keywords:         |  Work issues:
        Authors:  Nils   |       Commit:
  Bruin                  |  257c0df6820e80995cc7be08f7d9c64e8fdfbca7
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/nbruin/18979         |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work


Comment:

 As I said in [comment:5 comment:5], the solution should be non intrusive
 and your solution is what I suggested at the very end of this comment.

 Though, using a list extension is twice slower. With
 {{{
 def m1():
     cdef Py_ssize_t i
     cdef list l = [0] * 100
     for i in range(10): l[10*i + i] = 12
     return l
 def m2():
     cdef Py_ssize_t i,j
     return [12 if i == j else 0 for i in range(10) for j in range(10)]
 }}}
 I got
 {{{
 sage: %runfile test.pyx
 sage: %timeit l = m1()
 1000000 loops, best of 3: 456 ns per loop
 sage: %timeit l = m2()
 1000000 loops, best of 3: 1.09 µs per loop
 }}}

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