Safe Haskell | None |
---|---|
Language | Haskell2010 |
Interfaces for "gadgets," decomposition, and error correction.
- class Ring u => Gadget gad u where
- class (Gadget gad u, Reduce (DecompOf u) u) => Decompose gad u where
- type DecompOf u
- class Gadget gad u => Correct gad u where
- decomposeT :: Decompose gad u => u -> TaggedT gad [] (DecompOf u)
- decomposeList :: Decompose gad u => [u] -> Tagged gad [DecompOf u]
- decomposeMatrix :: forall gad u. Decompose gad u => Matrix u -> Tagged gad (Matrix (DecompOf u))
- data TrivGad
- data BaseBGad b
Documentation
class Ring u => Gadget gad u where Source #
Gadget vectors, parameterized by an index type.
gadget :: Tagged gad [u] Source #
The gadget vector over u
.
encode :: u -> Tagged gad [u] Source #
Yield an error-tolerant encoding of an element with respect to the gadget. (Mathematically, this should just be the product of the input with the gadget, but it is a class method to allow for optimized implementations.)
(Gadget k gad a, Gadget k gad b) => Gadget k gad (a, b) Source # | Product ring: concatenate gadgets over component rings |
(Gadget k gad zq, Fact m, CElt t zq) => Gadget k gad (Cyc t m zq) Source # | promoted from base ring |
(Reflects k q z, ToInteger z) => Gadget * TrivGad (ZqBasic k q z) Source # | |
(Reflects k1 q z, ToInteger z, RealIntegral z, Reflects k b z) => Gadget * (BaseBGad k b) (ZqBasic k1 q z) Source # | |
class (Gadget gad u, Reduce (DecompOf u) u) => Decompose gad u where Source #
Decomposition relative to a gadget.
decompose :: u -> Tagged gad [DecompOf u] Source #
Yield a short vector \( x \) such that \( \langle g, x\rangle = u \).
(Decompose k gad a, Decompose k gad b, (~) * (DecompOf a) (DecompOf b)) => Decompose k gad (a, b) Source # | Product ring: concatenate decompositions for component rings |
(Decompose k gad zq, Fact m, CElt t zq, CElt t (DecompOf zq)) => Decompose k gad (Cyc t m zq) Source # | promoted from base ring, using the powerful basis for best geometry |
(Reflects k q z, ToInteger z) => Decompose * TrivGad (ZqBasic k q z) Source # | |
(Reflects k1 q z, ToInteger z, Reflects k b z) => Decompose * (BaseBGad k b) (ZqBasic k1 q z) Source # | |
class Gadget gad u => Correct gad u where Source #
Error correction relative to a gadget.
correct :: Tagged gad [u] -> (u, [LiftOf u]) Source #
Error-correct a "noisy" encoding of an element (see encode
),
returning the encoded element and the error vector.
(Correct k gad a, Correct k gad b, Mod a, Mod b, Field a, Field b, Lift' a, Lift' b, ToInteger (LiftOf a), ToInteger (LiftOf b)) => Correct k gad (a, b) Source # | Product ring |
(Correct k gad zq, Fact m, CElt t zq) => Correct k gad (Cyc t m zq) Source # | promoted from base ring, using the decoding basis for best geometry |
(Reflects k q z, ToInteger z, Ring z) => Correct * TrivGad (ZqBasic k q z) Source # | |
(Reflects k1 q z, ToInteger z, Reflects k b z) => Correct * (BaseBGad k b) (ZqBasic k1 q z) Source # | |
decomposeList :: Decompose gad u => [u] -> Tagged gad [DecompOf u] Source #
Decompose a list entry-wise.
decomposeMatrix :: forall gad u. Decompose gad u => Matrix u -> Tagged gad (Matrix (DecompOf u)) Source #
Decompose a matrix entry-wise.
Dummy type representing the gadget \( [1] \).
Dummy type representing the gadget \( [1,b,b^2,\ldots] \).
(Reflects k1 q z, ToInteger z, Reflects k b z) => Correct * (BaseBGad k b) (ZqBasic k1 q z) Source # | |
(Reflects k1 q z, ToInteger z, Reflects k b z) => Decompose * (BaseBGad k b) (ZqBasic k1 q z) Source # | |
(Reflects k1 q z, ToInteger z, RealIntegral z, Reflects k b z) => Gadget * (BaseBGad k b) (ZqBasic k1 q z) Source # | |