lol-0.4.0.0: A library for lattice cryptography.

Crypto.Lol.Types.ZqBasic

Description

$$\def\Z{\mathbb{Z}}$$ $$\def\C{\mathbb{C}}$$ An implementation of the quotient ring $$\Z_q = \Z/(q\Z)$$.

Synopsis

# Documentation

data ZqBasic q z Source #

The ring $$\Z_q$$ of integers modulo q, using underlying integer type z.

Instances

 Unbox z => Vector Vector (ZqBasic k q z) Source # MethodsbasicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (ZqBasic k q z) -> m (Vector (ZqBasic k q z)) #basicUnsafeThaw :: PrimMonad m => Vector (ZqBasic k q z) -> m (Mutable Vector (PrimState m) (ZqBasic k q z)) #basicLength :: Vector (ZqBasic k q z) -> Int #basicUnsafeSlice :: Int -> Int -> Vector (ZqBasic k q z) -> Vector (ZqBasic k q z) #basicUnsafeIndexM :: Monad m => Vector (ZqBasic k q z) -> Int -> m (ZqBasic k q z) #basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (ZqBasic k q z) -> Vector (ZqBasic k q z) -> m () #elemseq :: Vector (ZqBasic k q z) -> ZqBasic k q z -> b -> b # Unbox z => MVector MVector (ZqBasic k q z) Source # MethodsbasicLength :: MVector s (ZqBasic k q z) -> Int #basicUnsafeSlice :: Int -> Int -> MVector s (ZqBasic k q z) -> MVector s (ZqBasic k q z) #basicOverlaps :: MVector s (ZqBasic k q z) -> MVector s (ZqBasic k q z) -> Bool #basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (ZqBasic k q z)) #basicInitialize :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> m () #basicUnsafeReplicate :: PrimMonad m => Int -> ZqBasic k q z -> m (MVector (PrimState m) (ZqBasic k q z)) #basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> Int -> m (ZqBasic k q z) #basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> Int -> ZqBasic k q z -> m () #basicClear :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> m () #basicSet :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> ZqBasic k q z -> m () #basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> MVector (PrimState m) (ZqBasic k q z) -> m () #basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> MVector (PrimState m) (ZqBasic k q z) -> m () #basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (ZqBasic k q z) -> Int -> m (MVector (PrimState m) (ZqBasic k q z)) # (Reflects k q z, ToInteger z, Additive (ZqBasic k q z)) => Reduce Integer (ZqBasic k q z) Source # Methodsreduce :: Integer -> ZqBasic k q z Source # (Reflects k q z, ToInteger z) => Reduce z (ZqBasic k q z) Source # Methodsreduce :: z -> ZqBasic k q z Source # (Reflects k q z, ToInteger z, PID z, Enumerable (ZqBasic k q z)) => CRTrans Maybe (ZqBasic k q z) Source # MethodscrtInfo :: Reflects k m Int => TaggedT k * m Maybe (CRTInfo (ZqBasic k q z)) Source # (Reflects k q z, ToInteger z, Ring z) => Correct * TrivGad (ZqBasic k q z) Source # Methodscorrect :: Tagged TrivGad (ZqBasic k q z) [u] -> (u, [LiftOf u]) Source # (Reflects k q z, ToInteger z) => Decompose * TrivGad (ZqBasic k q z) Source # Associated Typestype DecompOf u :: * Source # Methodsdecompose :: u -> Tagged TrivGad (ZqBasic k q z) [DecompOf u] Source # (Reflects k q z, ToInteger z) => Gadget * TrivGad (ZqBasic k q z) Source # Methodsgadget :: Tagged TrivGad (ZqBasic k q z) [u] Source #encode :: u -> Tagged TrivGad (ZqBasic k q z) [u] Source # (Reflects k1 q z, ToInteger z, Reflects k b z) => Correct * (BaseBGad k b) (ZqBasic k1 q z) Source # Methodscorrect :: Tagged (BaseBGad k b) (ZqBasic k1 q z) [u] -> (u, [LiftOf u]) Source # (Reflects k1 q z, ToInteger z, Reflects k b z) => Decompose * (BaseBGad k b) (ZqBasic k1 q z) Source # Associated Typestype DecompOf u :: * Source # Methodsdecompose :: u -> Tagged (BaseBGad k b) (ZqBasic k1 q z) [DecompOf u] Source # (Reflects k1 q z, ToInteger z, RealIntegral z, Reflects k b z) => Gadget * (BaseBGad k b) (ZqBasic k1 q z) Source # Methodsgadget :: Tagged (BaseBGad k b) (ZqBasic k1 q z) [u] Source #encode :: u -> Tagged (BaseBGad k b) (ZqBasic k1 q z) [u] Source # (Fact m, Reflects k q Int64) => Protoable (CT m (ZqBasic k q Int64)) Source # Associated Typestype ProtoType (CT m (ZqBasic k q Int64)) :: * Source # MethodstoProto :: CT m (ZqBasic k q Int64) -> ProtoType (CT m (ZqBasic k q Int64)) Source #fromProto :: MonadError String m => ProtoType (CT m (ZqBasic k q Int64)) -> m (CT m (ZqBasic k q Int64)) Source # (Fact m, Reflects k q Int64) => Protoable (RT m (ZqBasic k q Int64)) Source # Associated Typestype ProtoType (RT m (ZqBasic k q Int64)) :: * Source # MethodstoProto :: RT m (ZqBasic k q Int64) -> ProtoType (RT m (ZqBasic k q Int64)) Source #fromProto :: MonadError String m => ProtoType (RT m (ZqBasic k q Int64)) -> m (RT m (ZqBasic k q Int64)) Source # Eq z => Eq (ZqBasic k q z) Source # Methods(==) :: ZqBasic k q z -> ZqBasic k q z -> Bool #(/=) :: ZqBasic k q z -> ZqBasic k q z -> Bool # Ord z => Ord (ZqBasic k q z) Source # Methodscompare :: ZqBasic k q z -> ZqBasic k q z -> Ordering #(<) :: ZqBasic k q z -> ZqBasic k q z -> Bool #(<=) :: ZqBasic k q z -> ZqBasic k q z -> Bool #(>) :: ZqBasic k q z -> ZqBasic k q z -> Bool #(>=) :: ZqBasic k q z -> ZqBasic k q z -> Bool #max :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #min :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z # Show z => Show (ZqBasic k q z) Source # MethodsshowsPrec :: Int -> ZqBasic k q z -> ShowS #show :: ZqBasic k q z -> String #showList :: [ZqBasic k q z] -> ShowS # (Reflects k q z, ToInteger z, Random z) => Random (ZqBasic k q z) Source # MethodsrandomR :: RandomGen g => (ZqBasic k q z, ZqBasic k q z) -> g -> (ZqBasic k q z, g) #random :: RandomGen g => g -> (ZqBasic k q z, g) #randomRs :: RandomGen g => (ZqBasic k q z, ZqBasic k q z) -> g -> [ZqBasic k q z] #randoms :: RandomGen g => g -> [ZqBasic k q z] #randomRIO :: (ZqBasic k q z, ZqBasic k q z) -> IO (ZqBasic k q z) #randomIO :: IO (ZqBasic k q z) # (Reflects k q z, ToInteger z, Random z) => Arbitrary (ZqBasic k q z) Source # Methodsarbitrary :: Gen (ZqBasic k q z) #shrink :: ZqBasic k q z -> [ZqBasic k q z] # Storable z => Storable (ZqBasic k q z) Source # MethodssizeOf :: ZqBasic k q z -> Int #alignment :: ZqBasic k q z -> Int #peekElemOff :: Ptr (ZqBasic k q z) -> Int -> IO (ZqBasic k q z) #pokeElemOff :: Ptr (ZqBasic k q z) -> Int -> ZqBasic k q z -> IO () #peekByteOff :: Ptr b -> Int -> IO (ZqBasic k q z) #pokeByteOff :: Ptr b -> Int -> ZqBasic k q z -> IO () #peek :: Ptr (ZqBasic k q z) -> IO (ZqBasic k q z) #poke :: Ptr (ZqBasic k q z) -> ZqBasic k q z -> IO () # NFData z => NFData (ZqBasic k q z) Source # Methodsrnf :: ZqBasic k q z -> () # (Reflects k q z, ToInteger z, PID z, Show z) => C (ZqBasic k q z) Source # Methods(/) :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #recip :: ZqBasic k q z -> ZqBasic k q z #fromRational' :: Rational -> ZqBasic k q z #(^-) :: ZqBasic k q z -> Integer -> ZqBasic k q z # (Reflects k q z, ToInteger z, Field (ZqBasic k q z)) => C (ZqBasic k q z) Source # Methodsdiv :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #mod :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #divMod :: ZqBasic k q z -> ZqBasic k q z -> (ZqBasic k q z, ZqBasic k q z) # (Reflects k q z, ToInteger z, Ring z) => C (ZqBasic k q z) Source # Methods(*) :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #one :: ZqBasic k q z #fromInteger :: Integer -> ZqBasic k q z #(^) :: ZqBasic k q z -> Integer -> ZqBasic k q z # C z => C (ZqBasic k q z) Source # MethodsisZero :: ZqBasic k q z -> Bool # (Reflects k q z, ToInteger z, Additive z) => C (ZqBasic k q z) Source # Methodszero :: ZqBasic k q z #(+) :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #(-) :: ZqBasic k q z -> ZqBasic k q z -> ZqBasic k q z #negate :: ZqBasic k q z -> ZqBasic k q z # Elt z => Elt (ZqBasic k q z) Source # Methodstouch :: ZqBasic k q z -> IO () #zero :: ZqBasic k q z #one :: ZqBasic k q z # Unbox z => Unbox (ZqBasic k q z) Source # (Reflects k q z, ToInteger z) => Lift' (ZqBasic k q z) Source # Methodslift :: ZqBasic k q z -> LiftOf (ZqBasic k q z) Source # (Reflects k q z, ToInteger z) => Mod (ZqBasic k q z) Source # Associated Typestype ModRep (ZqBasic k q z) :: * Source # Methodsmodulus :: Tagged * (ZqBasic k q z) (ModRep (ZqBasic k q z)) Source # (Reflects k q z, ToInteger z, Enum z) => Enumerable (ZqBasic k q z) Source # Methodsvalues :: [ZqBasic k q z] Source # (Reflects k q z, ToInteger z, Ring (ZqBasic k q z)) => CRTEmbed (ZqBasic k q z) Source # Embeds into the complex numbers $$\C$$. Associated Typestype CRTExt (ZqBasic k q z) :: * Source # MethodstoExt :: ZqBasic k q z -> CRTExt (ZqBasic k q z) Source #fromExt :: CRTExt (ZqBasic k q z) -> ZqBasic k q z Source # (PPow pp, (~) * zq (ZqBasic PrimePower pp z), PrimeField (ZpOf zq), Ring zq) => ZPP (ZqBasic PrimePower pp z) Source # Associated Typestype ZpOf (ZqBasic PrimePower pp z) :: * Source # MethodsliftZp :: ZpOf (ZqBasic PrimePower pp z) -> ZqBasic PrimePower pp z Source # (Reflects k p z, Reflects k1 q z, ToInteger z, Field (ZqBasic k1 q z), Field (ZqBasic k p z)) => Encode (ZqBasic k p z) (ZqBasic k1 q z) Source # MethodslsdToMSD :: (ZqBasic k p z, ZqBasic k1 q z) Source # (Reflects k q z, ToInteger z, Reflects k1 q' z, Ring z) => Rescale (ZqBasic k q z) (ZqBasic k1 q' z) Source # Methodsrescale :: ZqBasic k q z -> ZqBasic k1 q' z Source # (ToInteger i, RealField r, Reflects k q i, Reflects k q r) => Subgroup (ZqBasic k q i) (RRq k q r) Source # MethodsfromSubgroup :: ZqBasic k q i -> RRq k q r Source # data MVector s (ZqBasic k q z) Source # data MVector s (ZqBasic k q z) = MV_ZqBasic (MVector s z) type CharOf k (ZqBasic k p z) Source # type CharOf k (ZqBasic k p z) = p type ProtoType (CT m (ZqBasic k q Int64)) Source # type ProtoType (CT m (ZqBasic k q Int64)) = Rq type ProtoType (RT m (ZqBasic k q Int64)) Source # type ProtoType (RT m (ZqBasic k q Int64)) = Rq data Vector (ZqBasic k q z) Source # data Vector (ZqBasic k q z) = V_ZqBasic (Vector z) type LiftOf (ZqBasic k q z) Source # type LiftOf (ZqBasic k q z) = z type ModRep (ZqBasic k q z) Source # type ModRep (ZqBasic k q z) = z type CRTExt (ZqBasic k q z) Source # type CRTExt (ZqBasic k q z) = Complex Double type ZpOf (ZqBasic PrimePower pp z) Source # type ZpOf (ZqBasic PrimePower pp z) = ZqBasic PrimeBin (PrimePP pp) z type DecompOf (ZqBasic k q z) Source # type DecompOf (ZqBasic k q z) = z type DecompOf (ZqBasic k q z) Source # type DecompOf (ZqBasic k q z) = z