Copyright | (c) Eric Crockett 2011-2017 Chris Peikert 2011-2017 |
---|---|
License | GPL-3 |
Maintainer | ecrockett0@email.com |
Stability | experimental |
Portability | POSIX \( \def\F{\mathbb{F}} \) |
Safe Haskell | None |
Language | Haskell2010 |
Basic (unoptimized) finite field arithmetic.
Synopsis
- data GF fp d
- type PrimeField fp = (Enumerable fp, Field fp, Eq fp, ZeroTestable fp, Prime (CharOf fp), IrreduciblePoly fp)
- type GFCtx fp d = (PrimeField fp, Reflects d Int)
- size :: GFCtx fp d => Tagged (GF fp d) Int
- trace :: forall fp d. GFCtx fp d => GF fp d -> fp
- toList :: forall fp d. (Reflects d Int, Additive fp) => GF fp d -> [fp]
- fromList :: forall fp d. Reflects d Int => [fp] -> GF fp d
- class Field fp => IrreduciblePoly fp where
- irreduciblePoly :: Reflects d Int => Tagged d (Polynomial fp)
- data X = X
- (^^) :: Ring a => X -> Int -> Polynomial a
- newtype TensorCoeffs a = Coeffs {
- unCoeffs :: [a]
Documentation
A finite field of given degree over \(\F_p\).
Instances
(GFCtx fp d, NFData fp) => CRTrans Maybe (GF fp d) Source # | |
(Eq fp, C fp) => Eq (GF fp d) Source # | |
Show fp => Show (GF fp d) Source # | |
(Random fp, Reflects d Int) => Random (GF fp d) Source # | |
Defined in Crypto.Lol.Types.FiniteField | |
NFData fp => NFData (GF fp d) Source # | |
Defined in Crypto.Lol.Types.FiniteField | |
GFCtx fp d => C (GF fp d) Source # | |
GFCtx fp d => C (GF fp d) Source # | |
C fp => C (GF fp d) Source # | |
Defined in Crypto.Lol.Types.FiniteField | |
C fp => C (GF fp d) Source # | |
GFCtx fp d => Enumerable (GF fp d) Source # | |
Defined in Crypto.Lol.Types.FiniteField | |
(Additive fp, Ring (GF fp d), Reflects d Int) => C (GF fp d) (TensorCoeffs fp) Source # | |
Defined in Crypto.Lol.Types.FiniteField (*>) :: GF fp d -> TensorCoeffs fp -> TensorCoeffs fp # | |
(Ring (GF (ZqBasic q z) d), Module (GF (ZqBasic q z) d) (CycG t m (ZqBasic q z))) => C (GF (ZqBasic q z) d) (Cyc t m (ZqBasic q z)) Source # | |
(GFCtx fp d, Fact m, TensorPowDec t fp, Module (GF fp d) (t m fp)) => C (GF fp d) (CycRep t P m fp) Source # | \(R_p\) is an \(\F_{p^d}\)-module when \(d\) divides \(\varphi(m)\), by applying \(d\)-dimensional \(\F_p\)-linear transform on \(d\)-dim chunks of powerful basis coeffs. |
type PrimeField fp = (Enumerable fp, Field fp, Eq fp, ZeroTestable fp, Prime (CharOf fp), IrreduciblePoly fp) Source #
Constraint synonym for a prime field.
size :: GFCtx fp d => Tagged (GF fp d) Int Source #
The order of the field: size (GF fp d) =
\( p^d \)
toList :: forall fp d. (Reflects d Int, Additive fp) => GF fp d -> [fp] Source #
Yield a list of length exactly \(d\) (i.e., including trailing zeros) of the \(\F_p\)-coefficients with respect to the power basis.
fromList :: forall fp d. Reflects d Int => [fp] -> GF fp d Source #
Yield a field element given up to \(d\) coefficients with respect to the power basis.
class Field fp => IrreduciblePoly fp where Source #
Represents fields over which we can get irreducible polynomials of desired degrees. (An instance of this class is defined in Crypto.Lol.Types.IrreducibleChar2 and exported from Crypto.Lol.Types.)
irreduciblePoly :: Reflects d Int => Tagged d (Polynomial fp) Source #
Instances
((CharOf a :: PrimeBin) ~ Prime2, Field a) => IrreduciblePoly a Source # | |
Defined in Crypto.Lol.Types.IrreducibleChar2 irreduciblePoly :: Reflects d Int => Tagged d (Polynomial a) Source # |
(^^) :: Ring a => X -> Int -> Polynomial a Source #
Convenience function for writing IrreduciblePoly
instances.
newtype TensorCoeffs a Source #
This wrapper for a list of coefficients is used to define a \(\F_{p^d}\)-module structure for tensors over \(\F_p\) of dimension \(n\), where \(d \mid n\).
Instances
C a => C (TensorCoeffs a) Source # | |
Defined in Crypto.Lol.Types.FiniteField zero :: TensorCoeffs a # (+) :: TensorCoeffs a -> TensorCoeffs a -> TensorCoeffs a # (-) :: TensorCoeffs a -> TensorCoeffs a -> TensorCoeffs a # negate :: TensorCoeffs a -> TensorCoeffs a # | |
(Additive fp, Ring (GF fp d), Reflects d Int) => C (GF fp d) (TensorCoeffs fp) Source # | |
Defined in Crypto.Lol.Types.FiniteField (*>) :: GF fp d -> TensorCoeffs fp -> TensorCoeffs fp # |