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.

  • ret_vars :: [Ident]

    return variables to store the result in.

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 (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) #

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 (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) #