#5974: [with patch; needs review] the generic linear_combination_of_rows and
linear_combination_of_columns functions for matrices are very stupidly
slotch
----------------------------+-----------------------------------------------
 Reporter:  was             |       Owner:  was     
     Type:  defect          |      Status:  new     
 Priority:  major           |   Milestone:  sage-4.0
Component:  linear algebra  |    Keywords:          
----------------------------+-----------------------------------------------

Old description:

> Behold.  By replacing about 40 confusing lines by 2 trivial lines, I get
> a *speedup* by more than a factor of 10!
>
> {{{
> BEFORE:
> sage: A = random_matrix(QQ,50)
> sage: v = [1..50]
> sage: timeit('A.linear_combination_of_rows(v)')
> 125 loops, best of 3: 5.48 ms per loop
>
> AFTER:
> sage: A = random_matrix(QQ,50)
> sage: v = [1..50]
> sage: timeit('A.linear_combination_of_rows(v)')
> 625 loops, best of 3: 503 µs per loop
>
> }}}

New description:

 Behold.  By replacing about 40 confusing lines by 2 trivial lines, I get a
 *speedup* by more than a factor of 10!

 {{{
 BEFORE:
 sage: A = random_matrix(QQ,50)
 sage: v = [1..50]
 sage: timeit('A.linear_combination_of_rows(v)')
 125 loops, best of 3: 5.48 ms per loop

 AFTER:
 sage: A = random_matrix(QQ,50)
 sage: v = [1..50]
 sage: timeit('A.linear_combination_of_rows(v)')
 625 loops, best of 3: 503 µs per loop

 }}}

 We also uncover several bugs in matrix multiply, which this patch also
 fixes.

--

Comment(by was):

 I ran a fulldoctest cycle with this patch applied and found yet another
 serious bug in matrix multiplication (not caused by this patch, but
 uncovered by it).  E.g., in vanilla released 3.4.1, some multiplies of
 cyclotomic matrices just go boom!

 {{{
 wst...@sage:~$ sage
 ----------------------------------------------------------------------
 | Sage Version 3.4.1, Release Date: 2009-04-21                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 sage: K.<zeta6>=CyclotomicField(6); matrix(K,1,2) * matrix(K,2,[0, 1, 0,
 -2*zeta6, 0, 0, 1, -2*zeta6 + 1])
 ---------------------------------------------------------------------------
 IndexError                                Traceback (most recent call
 last)

 
/scratch/wstein/sage/temp/sage.math.washington.edu/15110/_scratch_wstein_sage_init_sage_0.py
 in <module>()

 /home/wstein/sage/local/lib/python2.5/site-
 packages/sage/structure/element.so in
 sage.structure.element.Matrix.__mul__ (sage/structure/element.c:11263)()

 /home/wstein/sage/local/lib/python2.5/site-
 packages/sage/structure/coerce.so in
 sage.structure.coerce.CoercionModel_cache_maps.bin_op
 (sage/structure/coerce.c:5396)()

 /home/wstein/sage/local/lib/python2.5/site-packages/sage/matrix/action.so
 in sage.matrix.action.MatrixMatrixAction._call_
 (sage/matrix/action.c:2485)()

 /home/wstein/sage/local/lib/python2.5/site-
 packages/sage/matrix/matrix_cyclo_dense.so in
 sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense._matrix_times_matrix_
 (sage/matrix/matrix_cyclo_dense.cpp:5674)()

 /home/wstein/sage/local/lib/python2.5/site-
 packages/sage/matrix/matrix_integer_dense.so in
 sage.matrix.matrix_integer_dense._lift_crt
 (sage/matrix/matrix_integer_dense.c:32188)()

 IndexError: list index out of range
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5974#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

--~--~---------~--~----~------------~-------~--~----~
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