Ticket #3588 (closed defect: fixed)

Opened 5 months ago

Last modified 3 months ago

[with patch, needs review] Divison may involve lengthy calculations

Reported by: robertwb Assigned to: robertwb
Priority: major Milestone: sage-3.0.6
Component: coercion Keywords:
Cc:

Description

sage: p = random_prime(2^1000, proof=False)

sage: r = Integers(p)(2)

sage: time 1/r
CPU times: user 8.33 s, sys: 0.04 s, total: 8.37 s
Wall time: 8.38 s
 3499526081536621642679042248089160305431650460015592790597504050874839449753564641181241694531732168529968232075793871659087004627036430097798051425534663680136477216778245568521334956231031996455409743133009480089945324001250066901998383114487031466512725971538453941363837544198631115493811447198845

The generic fraction_field() call does primality testing here, takes too long.

Attachments

3588-slowdiv.patch (3.9 kB) - added by robertwb on 07/07/2008 02:05:46 PM.
quickfix.patch (0.7 kB) - added by was on 07/11/2008 11:48:11 AM.

Change History

07/07/2008 02:05:46 PM changed by robertwb

  • attachment 3588-slowdiv.patch added.

07/07/2008 02:06:12 PM changed by robertwb

  • status changed from new to assigned.
  • summary changed from Divison may involve lengthy calculations to [with patch, needs review] Divison may involve lengthy calculations.

07/11/2008 10:50:22 AM changed by mabshoff

  • milestone changed from sage-3.0.6 to sage-3.0.5.

This is 3.0.5 material, too.

Cheers,

Michael

07/11/2008 11:03:51 AM changed by was

  • summary changed from [with patch, needs review] Divison may involve lengthy calculations to [with patch, positive review] Divison may involve lengthy calculations.

07/11/2008 11:04:04 AM changed by was

  • status changed from assigned to closed.
  • resolution set to fixed.

07/11/2008 11:47:18 AM changed by was

  • status changed from closed to reopened.
  • summary changed from [with patch, positive review] Divison may involve lengthy calculations to [with patch, needs review] Divison may involve lengthy calculations.
  • resolution deleted.
  • milestone changed from sage-3.0.5 to sage-3.0.6.

A doctest failed in infinity.py. I've posted a quick fix here. Robert could easily have a better fix, so this is reopened.

07/11/2008 11:48:11 AM changed by was

  • attachment quickfix.patch added.

07/11/2008 12:02:12 PM changed by mabshoff

  • milestone changed from sage-3.0.6 to sage-3.0.5.

08/24/2008 10:16:33 AM changed by cremona

Are these patches still needed? In 3.1.1:

sage: p = random_prime(2^1000, proof=False)
sage: r = Integers(p)(2)                   
sage: time 1/r
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
4182378068297747496347619509094946589859242110649682753826323779912818104926185222329257414498084527466823768975174201208996376519370243477775194265315260528263826200480626844830896267031936271294686269384932307195051185481109989133791723199020928430708397791147367704717745601696690836602407579616974
sage: %timeit 1/r
100000 loops, best of 3: 5.21 µs per loop
sage: %timeit 1/Integers(p)(2)
100000 loops, best of 3: 16.8 µs per loop

08/24/2008 10:33:38 AM changed by mabshoff

  • status changed from reopened to closed.
  • resolution set to fixed.
  • milestone changed from sage-3.1.2 to sage-3.0.6.

This patch was merged in Sage 3.0.6, so I am closing it. The issue it caused to appear was related to weak references and Cython. Thanks for finding this John.

Cheers,

Michael