traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.Primitives.Amplify.Prelude

Synopsis

Amplify Primitive

data Amplify sizeT precT #

Primitive amplify that takes a sampler and returns a good sample w.h.p. The sampler must return a sample and a boolean flag, and if there is a good sample, it should return one with probability at least p_min.

Constructors

Amplify 

Fields

Instances

Instances details
Read precT => Read (Amplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

readsPrec :: Int -> ReadS (Amplify sizeT precT) #

readList :: ReadS [Amplify sizeT precT] #

readPrec :: ReadPrec (Amplify sizeT precT) #

readListPrec :: ReadPrec [Amplify sizeT precT] #

Show precT => Show (Amplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

showsPrec :: Int -> Amplify sizeT precT -> ShowS #

show :: Amplify sizeT precT -> String #

showList :: [Amplify sizeT precT] -> ShowS #

Eq precT => Eq (Amplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

(==) :: Amplify sizeT precT -> Amplify sizeT precT -> Bool #

(/=) :: Amplify sizeT precT -> Amplify sizeT precT -> Bool #

(Show prec, Fractional prec) => SerializePrim (Amplify size prec) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

primNames :: [Ident] #

primNameOf :: Amplify size prec -> Ident #

parsePrimParams :: TokenParser () -> Ident -> Parser (Amplify size prec) #

printPrimParams :: Amplify size prec -> [String] #

MapSize (Amplify size prec) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Associated Types

type MappedSize (Amplify size prec) size' #

Methods

mapSize :: (size0 ~ SizeType (Amplify size prec), size' ~ SizeType ext', ext' ~ MappedSize (Amplify size prec) size') => (size0 -> size') -> Amplify size prec -> ext' #

TypingReqs sizeT => TypeCheckPrim (Amplify sizeT precT) sizeT # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

inferRetTypesPrim :: forall ext' shape m. (m ~ TypeChecker ext', sizeT ~ SizeType ext', shape ~ PrimFnShape (Amplify sizeT precT)) => Amplify sizeT precT -> shape (FnType sizeT) -> m [VarType sizeT] #

(Ord precT, sizeT ~ SizeT, EvalReqs sizeT precT) => EvalPrim (Amplify sizeT precT) sizeT precT #

Evaluate an amplify call by evaluating the sampler f to get distribution μ and get success probability Psucc := P(b=1) conditioned on μ. Finally, returning the distribution based on Psucc.

Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

evalPrim :: forall ext' shape m. (Evaluatable ext' sizeT precT, m ~ Evaluator ext', SizeType ext' ~ sizeT, PrecType ext' ~ precT, shape ~ PrimFnShape (Amplify sizeT precT)) => Amplify sizeT precT -> shape ([Value sizeT] -> m [Value sizeT]) -> m [Value sizeT] #

(Amplify sizeT precT) :<: (CAmplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.CAmplify

Methods

inject :: Amplify sizeT precT -> CAmplify sizeT precT #

project :: CAmplify sizeT precT -> Maybe (Amplify sizeT precT) #

(Amplify sizeT precT) :<: (QAmplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.QAmplify

Methods

inject :: Amplify sizeT precT -> QAmplify sizeT precT #

project :: QAmplify sizeT precT -> Maybe (Amplify sizeT precT) #

type PrecType (Amplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

type PrecType (Amplify sizeT precT) = precT
type SizeType (Amplify sizeT precT) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

type SizeType (Amplify sizeT precT) = sizeT
type PrimFnShape (Amplify size prec) # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

type PrimFnShape (Amplify size prec) = SamplerFn
type MappedSize (Amplify size prec) size' # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

type MappedSize (Amplify size prec) size' = Amplify size' prec

newtype SamplerFn a #

Constructors

SamplerFn a 

Instances

Instances details
ValidPrimShape SamplerFn # 
Instance details

Defined in Traq.Primitives.Amplify.Prelude

Methods

listToShape :: [a] -> Either String (SamplerFn a) #

shapeToList :: SamplerFn a -> [a] #