Class: HenselCode::FiniteGadicExpansion

Inherits:
GAdicBase
  • Object
show all
Defined in:
lib/hensel_code/finite_gadic_expansion.rb

Overview

truncated finite g-adic expansion hensel code class

Instance Attribute Summary

Attributes inherited from GAdicBase

#exponent, #g, #hensel_code, #n, #primes, #rational

Instance Method Summary collapse

Methods inherited from GAdicBase

#*, #+, #-, #/, #denominator, #initialize, #numerator, #replace_exponent, #replace_hensel_code, #replace_primes, #replace_rational, #to_r

Methods included from GAdicVerifier

#different_primes_and_different_exponent?, #different_primes_and_same_exponent?, #incompatible_operand_type?, #same_primes_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::GAdicBase

Instance Method Details

#inspectObject



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

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

#inverseObject



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

def inverse
  new_hensel_code = hensel_code.map(&:inverse)
  self.class.new primes, exponent, new_hensel_code
end

#modululiObject



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

def modululi
  primes.map { |prime| prime**exponent }
end

#to_aObject



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

def to_a
  hensel_code.map(&:to_a)
end

#to_sObject



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

def to_s
  hensel_code.map(&:to_s).to_s
end