#19341: Cleaning/Fix in combinat/matrices/hadamard_matrix
-------------------------------------+-------------------------------------
       Reporter:  ncohen             |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.9
      Component:  combinatorial      |   Resolution:
  designs                            |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Nathann Cohen      |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/ncohen/19341     |  83bbce2b3d5e8940971f4fe3196e088d58fc018a
   Dependencies:  #19340             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by dimpase):

 please don't use the coersion, unless really needed:
 {{{
 sage: # your implementation:
 sage: timeit('matrix(ZZ, [[2*((x-y).is_square()-.5) for x in K_list] for y
 in K_list])')
 5 loops, best of 3: 269 ms per loop
 sage: # a direct one:
 sage: timeit('matrix(ZZ, [[1 if (x-y).is_square() else -1 for x in K_list]
 for y in K_list])')
 25 loops, best of 3: 27.9 ms per loop
 }}}
 (this timing is for `p=3^5`)

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