traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.Primitives.Class.Compile

Synopsis

Documentation

data PrimCompileEnv shape size #

Helpers to compile a primitive.

Constructors

PrimCompileEnv 

Fields

  • mk_ucall :: shape (UCallBuilder size)

    helper to generate a call to a unitary function argument.

  • mk_call :: shape (CallBuilder size)

    helper to generate a call to a classical function argument.

  • mk_meas :: shape (CallBuilder size)

    helper to generate a call-and-meas to a unitary proc arg.

  • uproc_aux_types :: shape [VarType size]

    auxiliary variables for each unitary function argument.

  • prim_ret_types :: [VarType size]

    return variables types.

class (size ~ SizeType prim, prec ~ PrecType prim, ValidPrimShape (PrimFnShape prim)) => UnitaryCompilePrim prim size prec | prim -> size prec where #

Compile a primitive to a uproc

Minimal complete definition

Nothing

Methods

compileUPrim :: forall ext' m shape. (m ~ PrimCompileMonad ext' prim, size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape prim) => prim -> FailProb prec -> m (ProcDef size) #

default compileUPrim :: forall ext' m shape. (Generic prim, GUnitaryCompilePrim (Rep prim) size prec, m ~ PrimCompileMonad ext' prim, size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape prim) => prim -> FailProb prec -> m (ProcDef size) #

Instances

Instances details
(TypingReqs size, Integral size, RealFloat prec, Show prec) => UnitaryCompilePrim (DefaultPrimCollection size prec) size prec # 
Instance details

Defined in Traq.Primitives

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (DefaultPrimCollection size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (DefaultPrimCollection size prec)) => DefaultPrimCollection size prec -> FailProb prec -> m (ProcDef size) #

UnitaryCompilePrim (CAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.CAmplify

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (CAmplify size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (CAmplify size prec)) => CAmplify size prec -> FailProb prec -> m (ProcDef size) #

(Floating prec, RealFrac prec) => UnitaryCompilePrim (QAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.QAmplify

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QAmplify size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QAmplify size prec)) => QAmplify size prec -> FailProb prec -> m (ProcDef size) #

(TypingReqs size, Integral size, RealFloat prec, Show prec) => UnitaryCompilePrim (QMax size prec) size prec # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QMax size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QMax size prec)) => QMax size prec -> FailProb prec -> m (ProcDef size) #

UnitaryCompilePrim (DetSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.DetSearch

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (DetSearch size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (DetSearch size prec)) => DetSearch size prec -> FailProb prec -> m (ProcDef size) #

(TypingReqs size, Integral size, RealFloat prec, Show prec) => UnitaryCompilePrim (QSearchCFNW size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QSearchCFNW size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QSearchCFNW size prec)) => QSearchCFNW size prec -> FailProb prec -> m (ProcDef size) #

UnitaryCompilePrim (RandomSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.RandomSearch

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (RandomSearch size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (RandomSearch size prec)) => RandomSearch size prec -> FailProb prec -> m (ProcDef size) #

(size ~ SizeT, RealFloat prec, Show prec) => UnitaryCompilePrim (SimonsFindXorPeriod size prec) size prec # 
Instance details

Defined in Traq.Primitives.Simons.Quantum

Methods

compileUPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (SimonsFindXorPeriod size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (SimonsFindXorPeriod size prec)) => SimonsFindXorPeriod size prec -> FailProb prec -> m (ProcDef size) #

class (size ~ SizeType prim, prec ~ PrecType prim, ValidPrimShape (PrimFnShape prim)) => QuantumCompilePrim prim size prec | prim -> size prec where #

Compile a primitive to a cq-proc

Minimal complete definition

Nothing

Methods

compileQPrim :: forall ext' m shape. (m ~ PrimCompileMonad ext' prim, size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape prim) => prim -> FailProb prec -> m (ProcDef size) #

default compileQPrim :: forall ext' m shape. (Generic prim, GQuantumCompilePrim (Rep prim) size prec, m ~ PrimCompileMonad ext' prim, size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape prim) => prim -> FailProb prec -> m (ProcDef size) #

Instances

Instances details
(size ~ SizeT, TypingReqs size, Integral size, RealFloat prec, Show prec) => QuantumCompilePrim (DefaultPrimCollection size prec) size prec # 
Instance details

Defined in Traq.Primitives

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (DefaultPrimCollection size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (DefaultPrimCollection size prec)) => DefaultPrimCollection size prec -> FailProb prec -> m (ProcDef size) #

QuantumCompilePrim (CAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.CAmplify

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (CAmplify size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (CAmplify size prec)) => CAmplify size prec -> FailProb prec -> m (ProcDef size) #

RealFloat prec => QuantumCompilePrim (QAmplify SizeT prec) SizeT prec # 
Instance details

Defined in Traq.Primitives.Amplify.QAmplify

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QAmplify SizeT prec), SizeT ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QAmplify SizeT prec)) => QAmplify SizeT prec -> FailProb prec -> m (ProcDef SizeT) #

(TypingReqs size, Integral size, RealFloat prec, Show prec, SizeToPrec size prec) => QuantumCompilePrim (QMax size prec) size prec # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QMax size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QMax size prec)) => QMax size prec -> FailProb prec -> m (ProcDef size) #

QuantumCompilePrim (DetSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.DetSearch

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (DetSearch size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (DetSearch size prec)) => DetSearch size prec -> FailProb prec -> m (ProcDef size) #

(RealFloat prec, Show prec) => QuantumCompilePrim (QSearchCFNW SizeT prec) SizeT prec # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (QSearchCFNW SizeT prec), SizeT ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (QSearchCFNW SizeT prec)) => QSearchCFNW SizeT prec -> FailProb prec -> m (ProcDef SizeT) #

QuantumCompilePrim (RandomSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.RandomSearch

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (RandomSearch size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (RandomSearch size prec)) => RandomSearch size prec -> FailProb prec -> m (ProcDef size) #

(size ~ SizeT, RealFloat prec, Show prec) => QuantumCompilePrim (SimonsFindXorPeriod size prec) size prec # 
Instance details

Defined in Traq.Primitives.Simons.Quantum

Methods

compileQPrim :: forall ext' m (shape :: Type -> Type). (m ~ PrimCompileMonad ext' (SimonsFindXorPeriod size prec), size ~ SizeType ext', prec ~ PrecType ext', shape ~ PrimFnShape (SimonsFindXorPeriod size prec)) => SimonsFindXorPeriod size prec -> FailProb prec -> m (ProcDef size) #

type PrimCompileMonad ext prim = ReaderT (PrimCompileEnv (PrimFnShape prim) (SizeType prim)) (CompilerT ext) #