Class: HenselCode::TruncatedFinitePadicExpansion

Inherits:
PAdicBase
  • Object
show all
Defined in:
lib/hensel_code/truncated_finite_padic_expansion.rb

Overview

truncated finite p-adic expansion hensel code class

Instance Attribute Summary

Attributes inherited from PAdicBase

#exponent, #hensel_code, #n, #prime, #rational

Instance Method Summary collapse

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 Method Details

#inspectObject



18
19
20
# File 'lib/hensel_code/truncated_finite_padic_expansion.rb', line 18

def inspect
  "<HenselCode: #{hensel_code}>"
end

#inverseObject



22
23
24
25
# File 'lib/hensel_code/truncated_finite_padic_expansion.rb', line 22

def inverse
  new_hensel_code = mod_inverse(hensel_code, modulus)
  self.class.new prime, exponent, new_hensel_code
end

#modulusObject



6
7
8
# File 'lib/hensel_code/truncated_finite_padic_expansion.rb', line 6

def modulus
  prime**exponent
end

#to_iObject



10
11
12
# File 'lib/hensel_code/truncated_finite_padic_expansion.rb', line 10

def to_i
  hensel_code
end

#to_sObject



14
15
16
# File 'lib/hensel_code/truncated_finite_padic_expansion.rb', line 14

def to_s
  hensel_code.to_s
end