Class: HenselCode::FinitePadicExpansion
- Defined in:
- lib/hensel_code/finite_padic_expansion.rb
Overview
finite p-adic expansion hensel code class
Instance Attribute Summary collapse
-
#polynomial ⇒ Object
Returns the value of attribute polynomial.
Attributes inherited from PAdicBase
#exponent, #hensel_code, #n, #prime, #rational
Instance Method Summary collapse
- #inspect ⇒ Object
- #inverse ⇒ Object
- #modulus ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
- #to_truncated ⇒ Object
Methods inherited from PAdicBase
#*, #+, #-, #/, #denominator, #initialize, #numerator, #replace_exponent, #replace_hensel_code, #replace_prime, #replace_rational, #to_r
Methods included from PAdicVerifier
#different_prime_and_different_exponent?, #different_prime_and_same_exponent?, #incompatible_operand_type?, #same_prime_and_different_exponent?, #valid?
Methods included from Tools
#crt, #eea_core, #extended_gcd, #mod_inverse, #random_distinct_numbers, #random_integer, #random_prime, #random_rational
Constructor Details
This class inherits a constructor from HenselCode::PAdicBase
Instance Attribute Details
#polynomial ⇒ Object
Returns the value of attribute polynomial.
6 7 8 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 6 def polynomial @polynomial end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 26 def inspect "<HenselCode: #{polynomial_form}>" end |
#inverse ⇒ Object
30 31 32 33 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 30 def inverse new_hensel_code = polynomial.inverse.coefficients self.class.new prime, exponent, new_hensel_code end |
#modulus ⇒ Object
8 9 10 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 8 def modulus prime end |
#to_a ⇒ Object
12 13 14 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 12 def to_a hensel_code end |
#to_s ⇒ Object
20 21 22 23 24 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 20 def to_s hensel_code.map.with_index do |h, i| "#{h}#{polynomial_variable(i)}" end.join(" + ") end |
#to_truncated ⇒ Object
16 17 18 |
# File 'lib/hensel_code/finite_padic_expansion.rb', line 16 def to_truncated TruncatedFinitePadicExpansion.new(prime, exponent, rational) end |