Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

from cpython.number cimport PyNumber_TrueDivide 

from sage.structure.element cimport Element 

  

  

ctypedef fused ulong_or_object: 

unsigned long 

object 

  

  

cpdef generic_power(a, n) 

cdef generic_power_long(a, long n) 

cdef generic_power_pos(a, ulong_or_object n) # n > 0 

  

  

cdef inline invert(a): 

""" 

Return ``a^(-1)``. 

""" 

if isinstance(a, Element): 

return ~a 

return PyNumber_TrueDivide(type(a)(1), a) 

  

  

cdef inline one(a): 

""" 

Return ``a^0``. 

""" 

if isinstance(a, Element): 

return (<Element>a)._parent.one() 

return type(a)(1)