Package sage :: Package rings :: Package padics :: Module pow_computer :: Class PowComputer_class
[hide private]
[frames] | no frames]

Class PowComputer_class



                      object --+    
                               |    
structure.sage_object.SageObject --+
                                   |
                                  PowComputer_class
Known Subclasses:
pow_computer_ext.PowComputer_ext, PowComputer_base

Instance Methods [hide private]
 
__call__(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 305) Returns self.prime^n.
 
__cmp__(x, y)
cmp(x,y)
 
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__new__(T, S, ...)
 
__repr__(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 231) Returns a string representation of self.
 
_cache_limit(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 263) Returns the limit to which powers of prime are computed.
 
_in_field(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 252) Returns whether or not self is attached to a field.
 
_pow_mpz_t_tmp_demo(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 148) This function demonstrates a danger in using pow_mpz_t_tmp.
 
_pow_mpz_t_tmp_test(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 183) Tests the pow_Integer function.
 
_pow_mpz_t_top_test(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 215) Tests the pow_mpz_t_top function.
 
_prec_cap(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 277)...
 
_prime(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 241) Returns the base that the PowComputer is exponentiating.
 
_top_power(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 291)...
 
pow_Integer_Integer(...)
File: sage/rings/padics/pow_computer.pyx (starting at line 97) Tests the pow_Integer function.

Inherited from structure.sage_object.SageObject: __hash__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, category, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(...)
(Call operator)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 305)

Returns self.prime^n.

EXAMPLES:
sage: P = PowComputer(3, 4, 6)
sage: P(3)
27
sage: P(6)
729
sage: P(5)
243
sage: P(7)
2187
sage: P(0)
1
sage: P(-2)
1/9

__init__(...)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__

__new__(T, S, ...)

 


Returns:
a new object with type S, a subtype of T

Overrides: structure.sage_object.SageObject.__new__

__repr__(...)
(Representation operator)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 231)

Returns a string representation of self.

EXAMPLES:
sage: PC = PowComputer(3, 5, 10); PC
PowComputer for 3

Overrides: structure.sage_object.SageObject.__repr__

_cache_limit(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 263)

Returns the limit to which powers of prime are computed.

EXAMPLES:
sage: P = PowComputer(3, 5, 10)
sage: P._cache_limit()
5

_in_field(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 252)

Returns whether or not self is attached to a field.

EXAMPLES:
sage: P = PowComputer(3, 5, 10)
sage: P._in_field()
False

_pow_mpz_t_tmp_demo(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 148)

This function demonstrates a danger in using pow_mpz_t_tmp.

EXAMPLES:
sage: PC = PowComputer(5, 5, 10)

When you cal pow_mpz_t_tmp with an input that is not stored
(ie n > self.cache_limit and n != self.prec_cap),
it stores the result in self.temp_m and returns a pointer
to that mpz_t.  So if you try to use the results of two
calls at once, things will break.
sage: PC._pow_mpz_t_tmp_demo(6, 8) # 244140625 on some architectures and 152587890625 on others: random
244140625
sage: 5^6*5^8
6103515625
sage: 5^6*5^6
244140625

Note that this does not occur if you try a stored value,
because the result of one of the calls points to that
stored value.
sage: PC._pow_mpz_t_tmp_demo(6, 10)
152587890625
sage: 5^6*5^10
152587890625        

_pow_mpz_t_tmp_test(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 183)

Tests the pow_Integer function.

EXAMPLES:
sage: PC = PowComputer(3, 5, 10)
sage: PC._pow_mpz_t_tmp_test(4)
81
sage: PC._pow_mpz_t_tmp_test(6)
729
sage: PC._pow_mpz_t_tmp_test(0)
1
sage: PC._pow_mpz_t_tmp_test(10)
59049
sage: PC = PowComputer_ext_maker(3, 5, 10, 20, False, ntl.ZZ_pX([-3,0,1], 3^10), 'big','e',ntl.ZZ_pX([1],3^10))
sage: PC._pow_mpz_t_tmp_test(4)
81
sage: PC._pow_mpz_t_tmp_test(6)
729
sage: PC._pow_mpz_t_tmp_test(0)
1
sage: PC._pow_mpz_t_tmp_test(10)
59049

_pow_mpz_t_top_test(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 215)

Tests the pow_mpz_t_top function.

EXAMPLES:
sage: PC = PowComputer(3, 5, 10)
sage: PC._pow_mpz_t_top_test()
59049
sage: PC = PowComputer_ext_maker(3, 5, 10, 20, False, ntl.ZZ_pX([-3,0,1], 3^10), 'big','e',ntl.ZZ_pX([1],3^10))
sage: PC._pow_mpz_t_top_test()
59049

_prec_cap(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 277)

Returns prec_cap, a single value that for which self._prime()^prec_cap is stored

EXAMPLES:
sage: P = PowComputer(3, 5, 10)
sage: P._prec_cap()
10

_prime(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 241)

Returns the base that the PowComputer is exponentiating.

EXAMPLES:
sage: P = PowComputer(6, 10, 15)
sage: P._prime()
6

_top_power(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 291)

Returns self._prime()^self._prec_cap()

EXAMPLES:
sage: P = PowComputer(3, 4, 6)
sage: P._top_power()
729

pow_Integer_Integer(...)

 
File: sage/rings/padics/pow_computer.pyx (starting at line 97)

Tests the pow_Integer function.

EXAMPLES:
sage: PC = PowComputer(3, 5, 10)
sage: PC.pow_Integer_Integer(4)
81
sage: PC.pow_Integer_Integer(6)
729
sage: PC.pow_Integer_Integer(0)
1
sage: PC.pow_Integer_Integer(10)
59049
sage: PC = PowComputer_ext_maker(3, 5, 10, 20, False, ntl.ZZ_pX([-3,0,1], 3^10), 'big','e',ntl.ZZ_pX([1],3^10))
sage: PC.pow_Integer_Integer(4)
81
sage: PC.pow_Integer_Integer(6)
729
sage: PC.pow_Integer_Integer(0)
1
sage: PC.pow_Integer_Integer(10)
59049