#12923: Comparison of vectors is O(n) even in the simple cases
------------------------------------------+---------------------------------
       Reporter:  hivert                  |         Owner:  jason, was
           Type:  defect                  |        Status:  needs_work
       Priority:  major                   |     Milestone:  sage-5.1  
      Component:  linear algebra          |    Resolution:            
       Keywords:  vector equality days38  |   Work issues:            
Report Upstream:  N/A                     |     Reviewers:            
        Authors:  Florent Hivert          |     Merged in:            
   Dependencies:                          |      Stopgaps:            
------------------------------------------+---------------------------------
Changes (by tscrim):

  * status:  needs_review => needs_work


Comment:

 It works fine for integers, but observe the following:
 {{{
 sage: l = 1000; v1 = vector(ZZ, [0]*l); v2 = vector(QQ, [1]*l)
 sage: %timeit v1 == v2
 5 loops, best of 3: 2.25 ms per loop
 sage: %timeit v1 == v2
 125 loops, best of 3: 3.24 ms per loop
 sage: %timeit v1 == v2
 125 loops, best of 3: 3.27 ms per loop
 sage: %timeit v1 == v2
 125 loops, best of 3: 3.35 ms per loop
 sage: l = 2000; v1 = vector(ZZ, [0]*l); v2 = vector(QQ, [1]*l)
 sage: %timeit v1 == v2
 5 loops, best of 3: 4.72 ms per loop
 sage: %timeit v1 == v2
 125 loops, best of 3: 6.81 ms per loop
 sage: %timeit v1 == v2
 125 loops, best of 3: 6.64 ms per loop
 }}}
 I can't test any higher because running these tests completely kills my
 memory (the first comparison will allocate ~150MB RAM, the second ~450MB
 RAM). It only allocates when I call the comparison. Also my memory usage
 did not drop when I reassign v1 and v2.

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