finite-fields-0.1: Arithmetic in finite fields
Safe HaskellNone
LanguageHaskell2010

Math.FiniteField.GaloisField.Zech

Description

Small Galois fields via precomputed tables of Zech's logarithms.

https://en.wikipedia.org/wiki/Zech%27s_logarithm

When "creating" a field, we precompute the Zech logarithm table. After that, computations should be fast.

This is practical up to fields of size 10^5 -- 10^6

TODO: also export the tables to C, and write C implementation of of the field operations.

Synopsis

Tables of Zech logarithms

data ZechTable Source #

Instances

Instances details
Show ZechTable Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

makeZechTable :: forall p m. WitnessGF p m -> ZechTable Source #

Witness for the existence of the field

newtype WitnessZech (p :: Nat) (m :: Nat) Source #

Constructors

WitnessZech 

Instances

Instances details
Show (WitnessZech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

showsPrec :: Int -> WitnessZech p m -> ShowS #

show :: WitnessZech p m -> String #

showList :: [WitnessZech p m] -> ShowS #

data SomeWitnessZech Source #

Constructors

forall p m. SomeWitnessZech (WitnessZech p m) 

Instances

Instances details
Show SomeWitnessZech Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Field elements

data Zech (p :: Nat) (m :: Nat) Source #

Instances

Instances details
Eq (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

(==) :: Zech p m -> Zech p m -> Bool #

(/=) :: Zech p m -> Zech p m -> Bool #

Fractional (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

(/) :: Zech p m -> Zech p m -> Zech p m #

recip :: Zech p m -> Zech p m #

fromRational :: Rational -> Zech p m #

Num (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

(+) :: Zech p m -> Zech p m -> Zech p m #

(-) :: Zech p m -> Zech p m -> Zech p m #

(*) :: Zech p m -> Zech p m -> Zech p m #

negate :: Zech p m -> Zech p m #

abs :: Zech p m -> Zech p m #

signum :: Zech p m -> Zech p m #

fromInteger :: Integer -> Zech p m #

Ord (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

compare :: Zech p m -> Zech p m -> Ordering #

(<) :: Zech p m -> Zech p m -> Bool #

(<=) :: Zech p m -> Zech p m -> Bool #

(>) :: Zech p m -> Zech p m -> Bool #

(>=) :: Zech p m -> Zech p m -> Bool #

max :: Zech p m -> Zech p m -> Zech p m #

min :: Zech p m -> Zech p m -> Zech p m #

Show (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Methods

showsPrec :: Int -> Zech p m -> ShowS #

show :: Zech p m -> String #

showList :: [Zech p m] -> ShowS #

Field (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

Associated Types

type Witness (Zech p m) = (r :: Type) Source #

Methods

characteristic :: Witness (Zech p m) -> Integer Source #

dimension :: Witness (Zech p m) -> Integer Source #

fieldSize :: Witness (Zech p m) -> Integer Source #

zero :: Witness (Zech p m) -> Zech p m Source #

one :: Witness (Zech p m) -> Zech p m Source #

isZero :: Zech p m -> Bool Source #

isOne :: Zech p m -> Bool Source #

embed :: Witness (Zech p m) -> Integer -> Zech p m Source #

embedSmall :: Witness (Zech p m) -> Int -> Zech p m Source #

randomFieldElem :: RandomGen gen => Witness (Zech p m) -> gen -> (Zech p m, gen) Source #

randomInvertible :: RandomGen gen => Witness (Zech p m) -> gen -> (Zech p m, gen) Source #

primGen :: Witness (Zech p m) -> Zech p m Source #

witnessOf :: Zech p m -> Witness (Zech p m) Source #

power :: Zech p m -> Integer -> Zech p m Source #

powerSmall :: Zech p m -> Int -> Zech p m Source #

enumerate :: Witness (Zech p m) -> [Zech p m] Source #

type Witness (Zech p m) Source # 
Instance details

Defined in Math.FiniteField.GaloisField.Zech

type Witness (Zech p m) = WitnessZech p m