Copyright | (c) Eric Crockett 2011-2017 Chris Peikert 2011-2017 |
---|---|
License | GPL-3 |
Maintainer | ecrockett0@email.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Crypto.Lol.CRTrans
Description
Classes and helper methods for the Chinese remainder transform and ring extensions.
Documentation
class (Monad mon, Ring r) => CRTrans mon r where Source #
A ring that (possibly) supports invertible Chinese remainder transformations of various indices.
The values of crtInfo
for different indices m should be
consistent, in the sense that if ωm, ωm′ are respectively
mth, m′th roots of unity where m divides m′, then
it should be the case that ωm′/mm′=ωm.
Methods
crtInfo :: Reflects m Int => TaggedT m mon (CRTInfo r) Source #
CRTInfo
for a given index m. The method itself may be
slow, but the function it returns should be fast, e.g., via
internal memoization.
Instances
CRTrans Maybe Double Source # | Returns |
CRTrans Maybe Int Source # | Returns |
CRTrans Maybe Int64 Source # | Returns |
CRTrans Maybe Integer Source # | Returns |
Transcendental a => CRTrans Maybe (Complex a) Source # | For testing ergonomics, we also have a |
Transcendental a => CRTrans Identity (Complex a) Source # | Complex numbers have |
(CRTrans mon a, CRTrans mon b) => CRTrans mon (a, b) Source # | Product ring |
(Reflects q z, ToInteger z, PID z, Enum z, NFData z) => CRTrans Maybe (ZqBasic q z) Source # | |
(GFCtx fp d, NFData fp) => CRTrans Maybe (GF fp d) Source # | |
class (Ring r, Ring (CRTExt r)) => CRTEmbed r where Source #
A ring with a ring embedding into some ring
that has
an invertible CRT transformation for every positive index m.CRTExt
r
Methods
toExt :: r -> CRTExt r Source #
Embeds from r
to CRTExt
r
fromExt :: CRTExt r -> r Source #
Projects from
to CRTExt
rr
Instances
CRTEmbed Double Source # | Embeds into the complex numbers C. |
CRTEmbed Int Source # | Embeds into the complex numbers C. |
CRTEmbed Int64 Source # | Embeds into the complex numbers C. |
CRTEmbed Integer Source # | Embeds into the complex numbers C. (May not have sufficient precision.) |
Transcendental a => CRTEmbed (Complex a) Source # | Self-embed |
(CRTEmbed a, CRTEmbed b) => CRTEmbed (a, b) Source # | Product ring |
(Reflects q z, ToInteger z, Ring (ZqBasic q z)) => CRTEmbed (ZqBasic q z) Source # | Embeds into the complex numbers C. |