Changeset 1069:98129ba8f46b for sage/libs/cf/cf.pyxe
- Timestamp:
- 08/07/06 14:17:09 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/libs/cf/cf.pyxe (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/libs/cf/cf.pyxe
r1036 r1069 144 144 INPUT: 145 145 146 name -- The level of the variable is specified to be the147 level of the variable which has name name. That means that148 the generated object can not only be a polynomial variable149 but also an algebraic or transcendental variable. In the150 case that there is no variable with name name the151 generated variable refers to the anonymous polynomial152 variable which has the lowest level. After the153 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. 156 156 157 157 level -- The constructor generates an object of class … … 210 210 """ 211 211 #embed{ int Variable_level(void *obj) 212 return ((Variable *)obj)->level();212 return ((Variable *)obj)->level(); 213 213 #}embed 214 214 … … 221 221 """ 222 222 #embed{ char Variable_name(void *obj) 223 return ((Variable *)obj)->name();223 return ((Variable *)obj)->name(); 224 224 #}embed 225 225 … … 250 250 """ 251 251 #embed{ int Variable_cmp(void *obj,void *obj2) 252 if(*(Variable *)obj == *(Variable *)obj2) {252 if(*(Variable *)obj == *(Variable *)obj2) { 253 253 return 0; 254 } else if( *(Variable *)obj < *(Variable *)obj2) {255 return -1;254 } else if( *(Variable *)obj < *(Variable *)obj2) { 255 return -1; 256 256 } else if( *(Variable *)obj > *(Variable *)obj2) { 257 return 1;257 return 1; 258 258 } 259 259 #}embed … … 505 505 #}embed 506 506 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)) 516 513 517 514 def __sub__(left, right): … … 649 646 """ 650 647 #embed{ int CF_cmp(void *obj,void *obj2) 651 if( *(CanonicalForm *)obj == *(CanonicalForm *)obj2 ) {648 if( *(CanonicalForm *)obj == *(CanonicalForm *)obj2 ) { 652 649 return 0; 653 } else if(*(CanonicalForm *)obj < *(CanonicalForm *)obj2) {654 return -1;650 } else if(*(CanonicalForm *)obj < *(CanonicalForm *)obj2) { 651 return -1; 655 652 } else if(*(CanonicalForm *)obj > *(CanonicalForm *)obj2) { 656 return 1;653 return 1; 657 654 } 658 655 #}embed … … 1330 1327 return r(polydict.PolyDict(d)) 1331 1328 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 1332 1340 1333 1341 CF = CanonicalForm
Note: See TracChangeset
for help on using the changeset viewer.
