Ticket #3927: trac3927-fix-gcd-lcm.patch

File trac3927-fix-gcd-lcm.patch, 1.5 kB (added by cwitty, 5 months ago)
  • a/sage/structure/factorization.py

    old new  
    10001000 
    10011001        """ 
    10021002        if not isinstance(other, Factorization): 
    1003             return self * Factorization([(other, 1)]) 
     1003            raise NotImplementedError, "can't take gcd of factorization and non-factorization" 
    10041004        if self.is_commutative() and other.is_commutative(): 
    10051005            d1 = dict(self) 
    10061006            d2 = dict(other) 
     
    10231023 
    10241024        """ 
    10251025        if not isinstance(other, Factorization): 
    1026             return self * Factorization([(other, 1)]) 
     1026            raise NotImplementedError, "can't take lcm of factorization and non-factorization" 
    10271027        if self.is_commutative() and other.is_commutative(): 
    10281028            d1 = dict(self) 
    10291029            d2 = dict(other) 
     
    10321032                s[a] = max(d1.get(a,0),d2.get(a,0)) 
    10331033            return Factorization(list(s.iteritems())) 
    10341034        else: 
    1035             raise NotImplementedError, "gcd is not implemented for non-commutative factorizations" 
     1035            raise NotImplementedError, "lcm is not implemented for non-commutative factorizations" 
    10361036 
    10371037         
    10381038    def is_integral(self):