Module: HenselCode::GAdicVerifier
- Included in:
- GAdicBase
- Defined in:
- lib/hensel_code/gadic_verifier.rb
Overview
verifications pre-evaluation of hensel codes
Instance Method Summary collapse
- #different_primes_and_different_exponent?(other) ⇒ Boolean
- #different_primes_and_same_exponent?(other) ⇒ Boolean
- #incompatible_operand_type?(other) ⇒ Boolean
- #same_primes_and_different_exponent?(other) ⇒ Boolean
- #valid?(other) ⇒ Boolean
Instance Method Details
#different_primes_and_different_exponent?(other) ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/hensel_code/gadic_verifier.rb', line 23 def different_primes_and_different_exponent?(other) = <<~MSG "#{self} has prime #{primes} and exponent #{exponent} while #{other} has prime #{other.primes} and exponent #{other.exponent} MSG raise HenselCodesWithDifferentPrimesAndExponents, if primes != other.primes && exponent != other.exponent end |
#different_primes_and_same_exponent?(other) ⇒ Boolean
18 19 20 21 |
# File 'lib/hensel_code/gadic_verifier.rb', line 18 def different_primes_and_same_exponent?(other) = "#{self} has primes #{primes} while #{other} has prime #{other.primes}" raise HenselCodesWithDifferentPrimes, if primes != other.primes && exponent == other.exponent end |
#incompatible_operand_type?(other) ⇒ Boolean
13 14 15 16 |
# File 'lib/hensel_code/gadic_verifier.rb', line 13 def incompatible_operand_type?(other) = "#{self} is a #{self.class} while #{other} is a #{other.class}" raise IncompatibleOperandTypes, unless instance_of?(other.class) end |
#same_primes_and_different_exponent?(other) ⇒ Boolean
31 32 33 34 |
# File 'lib/hensel_code/gadic_verifier.rb', line 31 def same_primes_and_different_exponent?(other) = "#{self} has exponent #{exponent} while #{other} has exponent #{other.exponent}" raise HenselCodesWithDifferentExponents, if primes == other.primes && exponent != other.exponent end |
#valid?(other) ⇒ Boolean
6 7 8 9 10 11 |
# File 'lib/hensel_code/gadic_verifier.rb', line 6 def valid?(other) incompatible_operand_type?(other) different_primes_and_same_exponent?(other) different_primes_and_different_exponent?(other) same_primes_and_different_exponent?(other) end |