Ignore:
Timestamp:
08/07/06 14:17:09 (7 years ago)
Author:
Martin Albrecht <malb@…>
Branch:
default
Message:

[project @ cf.CF indentation issues (again)]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/libs/cf/cf.pyxe

    r1036 r1069  
    144144        INPUT: 
    145145 
    146             name -- The level of the variable is specified to be the 
    147             level of the variable which has name name. That means that 
    148             the generated object can not only be a polynomial variable 
    149             but also an algebraic or transcendental variable. In the 
    150             case that there is no variable with name name the 
    151             generated variable refers to the anonymous polynomial 
    152             variable which has the lowest level. After the 
    153             construction the name of the variable is set to name. 
    154  
    155             If name is an integer it is interpreted as a level. 
     146            name -- The level of the variable is specified to be the 
     147            level of the variable which has name name. That means that 
     148            the generated object can not only be a polynomial variable 
     149            but also an algebraic or transcendental variable. In the 
     150            case that there is no variable with name name the 
     151            generated variable refers to the anonymous polynomial 
     152            variable which has the lowest level. After the 
     153            construction the name of the variable is set to name. 
     154 
     155            If name is an integer it is interpreted as a level. 
    156156 
    157157            level -- The constructor generates an object of class 
     
    210210        """ 
    211211        #embed{ int Variable_level(void *obj) 
    212         return ((Variable *)obj)->level(); 
     212        return ((Variable *)obj)->level(); 
    213213        #}embed 
    214214 
     
    221221        """ 
    222222        #embed{ char Variable_name(void *obj) 
    223         return ((Variable *)obj)->name(); 
     223        return ((Variable *)obj)->name(); 
    224224        #}embed 
    225225 
     
    250250        """ 
    251251        #embed{ int Variable_cmp(void *obj,void *obj2) 
    252         if(*(Variable *)obj == *(Variable *)obj2) { 
     252        if(*(Variable *)obj == *(Variable *)obj2) { 
    253253           return 0; 
    254         } else if( *(Variable *)obj < *(Variable *)obj2) { 
    255            return -1; 
     254        } else if( *(Variable *)obj < *(Variable *)obj2) { 
     255           return -1; 
    256256        } else if( *(Variable *)obj > *(Variable *)obj2) { 
    257            return 1; 
     257           return 1; 
    258258        }     
    259259        #}embed 
     
    505505        #}embed 
    506506 
    507         cdef CanonicalForm cRight 
    508         cdef CanonicalForm cLeft 
    509         try: 
    510             cLeft = CanonicalForm(left) 
    511             cRight = CanonicalForm(right) 
    512         except TypeError: 
    513             raise ArithmeticError, "Cannot add %s and %s"%(left,right) 
    514         _sig_on 
    515         return make_CF(CF_add(cLeft.thisptr,cRight.thisptr)) 
     507        if not isinstance(left,CanonicalForm): 
     508            left,right = right,left 
     509        if not isinstance(right,CanonicalForm): 
     510            right = CanonicalForm(right) 
     511        _sig_on 
     512        return make_CF(CF_add((<CanonicalForm>left).thisptr,(<CanonicalForm>right).thisptr)) 
    516513 
    517514    def __sub__(left, right): 
     
    649646        """ 
    650647        #embed{ int CF_cmp(void *obj,void *obj2) 
    651         if( *(CanonicalForm *)obj == *(CanonicalForm *)obj2 ) { 
     648        if( *(CanonicalForm *)obj == *(CanonicalForm *)obj2 ) { 
    652649           return 0; 
    653         } else if(*(CanonicalForm *)obj < *(CanonicalForm *)obj2) { 
    654            return -1; 
     650        } else if(*(CanonicalForm *)obj < *(CanonicalForm *)obj2) { 
     651           return -1; 
    655652        } else if(*(CanonicalForm *)obj > *(CanonicalForm *)obj2) { 
    656            return 1; 
     653           return 1; 
    657654        } 
    658655        #}embed 
     
    13301327            return r(polydict.PolyDict(d)) 
    13311328 
     1329    def lcm(CanonicalForm self,right): 
     1330        #embed{ void *CF_lcm(void *l, void *r) 
     1331        return new CanonicalForm(lcm(*(CanonicalForm*)l,(*(CanonicalForm*)r))); 
     1332        #}embed 
     1333 
     1334        if not isinstance(right,CanonicalForm): 
     1335            right = CanonicalForm(right) 
     1336        _sig_on 
     1337        return make_CF(CF_lcm(self.thisptr,(<CanonicalForm>right).thisptr)) 
     1338 
     1339 
    13321340 
    13331341CF =  CanonicalForm 
Note: See TracChangeset for help on using the changeset viewer.