Module: HenselCode::PAdicVerifier
- Included in:
- PAdicBase
- Defined in:
- lib/hensel_code/padic_verifier.rb
Overview
verifications pre-evaluation of hensel codes
Instance Method Summary collapse
- #different_prime_and_different_exponent?(other) ⇒ Boolean
- #different_prime_and_same_exponent?(other) ⇒ Boolean
- #incompatible_operand_type?(other) ⇒ Boolean
- #same_prime_and_different_exponent?(other) ⇒ Boolean
- #valid?(other) ⇒ Boolean
Instance Method Details
#different_prime_and_different_exponent?(other) ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/hensel_code/padic_verifier.rb', line 23 def different_prime_and_different_exponent?(other) = <<~MSG "#{self} has prime #{prime} and exponent #{exponent} while #{other} has prime #{other.prime} and exponent #{other.exponent} MSG raise HenselCodesWithDifferentPrimesAndExponents, if prime != other.prime && exponent != other.exponent end |
#different_prime_and_same_exponent?(other) ⇒ Boolean
18 19 20 21 |
# File 'lib/hensel_code/padic_verifier.rb', line 18 def different_prime_and_same_exponent?(other) = "#{self} has prime #{prime} while #{other} has prime #{other.prime}" raise HenselCodesWithDifferentPrimes, if prime != other.prime && exponent == other.exponent end |
#incompatible_operand_type?(other) ⇒ Boolean
13 14 15 16 |
# File 'lib/hensel_code/padic_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_prime_and_different_exponent?(other) ⇒ Boolean
31 32 33 34 |
# File 'lib/hensel_code/padic_verifier.rb', line 31 def same_prime_and_different_exponent?(other) = "#{self} has exponent #{exponent} while #{other} has exponent #{other.exponent}" raise HenselCodesWithDifferentExponents, if prime == other.prime && exponent != other.exponent end |
#valid?(other) ⇒ Boolean
6 7 8 9 10 11 |
# File 'lib/hensel_code/padic_verifier.rb', line 6 def valid?(other) incompatible_operand_type?(other) different_prime_and_same_exponent?(other) different_prime_and_different_exponent?(other) same_prime_and_different_exponent?(other) end |