#3214: [with patch, needs review] gcd needs improved coercion
------------------------------+---------------------------------------------
 Reporter:  novoselt          |        Owner:  somebody
     Type:  defect            |       Status:  reopened
 Priority:  blocker           |    Milestone:  sage-3.3
Component:  basic arithmetic  |   Resolution:          
 Keywords:                    |  
------------------------------+---------------------------------------------
Comment (by cremona):

 Hmmm.  It seems a real pity to just delete the quick exit line since in
 most circumstances as soon as you have a unit you can return 1.  This will
 result in a lot of calls to vi.gcd(g) where vi is random and g==1, so
 those had better be caught efficiently in the member gcd() function.
 (Incidentally, there was a reason for putting vi.gcd(g) and not g.gcd(vi),
 which I now forget.)

 It's another field-of-fractions thing;  in the example we are not really
 treating the rationals as elements of QQ, but as scaled elements of ZZ,
 where x.div(y) means y/x in ZZ even though x,y may be in QQ.  Testing for
 .is_unit() certainly would not be appropriate.  I cannot see a better way
 than what the patch does, unless we give up the nice behaviour that the
 gcd of a set of rationals is defined to be a generator of the ZZ-module
 they span.

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