galois-field-0.3.0: Galois field library

GaloisField

Synopsis

# Documentation

class (Arbitrary k, Eq k, Fractional k, Pretty k, Random k, Read k, Show k) => GaloisField k where Source #

Galois fields GF(p^q) for p prime and q non-negative.

Minimal complete definition

char, deg, frob, pow, quad, rnd, sr

Methods

char :: k -> Integer Source #

Characteristic p of field and order of prime subfield.

deg :: k -> Int Source #

Degree q of field as extension field over prime subfield.

order :: k -> Integer Source #

Order p^q of field.

frob :: k -> k Source #

Frobenius endomorphism x->x^p of prime subfield.

pow :: k -> Integer -> k Source #

Exponentiation of a field element to an integer.

quad :: k -> k -> k -> Maybe k Source #

Solve quadratic ax^2+bx+c=0 over field.

rnd :: MonadRandom m => m k Source #

Randomised field element.

sr :: k -> Maybe k Source #

Square root of a field element.

Instances
 KnownNat im => GaloisField (BinaryField im) Source # Instance detailsDefined in BinaryField Methodsdeg :: BinaryField im -> Int Source #frob :: BinaryField im -> BinaryField im Source #pow :: BinaryField im -> Integer -> BinaryField im Source #quad :: BinaryField im -> BinaryField im -> BinaryField im -> Maybe (BinaryField im) Source #rnd :: MonadRandom m => m (BinaryField im) Source #sr :: BinaryField im -> Maybe (BinaryField im) Source # Source # Instance detailsDefined in PrimeField Methodsdeg :: PrimeField p -> Int Source #quad :: PrimeField p -> PrimeField p -> PrimeField p -> Maybe (PrimeField p) Source #rnd :: MonadRandom m => m (PrimeField p) Source #sr :: PrimeField p -> Maybe (PrimeField p) Source # (GaloisField k, IrreducibleMonic k im) => GaloisField (ExtensionField k im) Source # Instance detailsDefined in ExtensionField Methodschar :: ExtensionField k im -> Integer Source #deg :: ExtensionField k im -> Int Source #order :: ExtensionField k im -> Integer Source #frob :: ExtensionField k im -> ExtensionField k im Source #pow :: ExtensionField k im -> Integer -> ExtensionField k im Source #quad :: ExtensionField k im -> ExtensionField k im -> ExtensionField k im -> Maybe (ExtensionField k im) Source #rnd :: MonadRandom m => m (ExtensionField k im) Source #sr :: ExtensionField k im -> Maybe (ExtensionField k im) Source #