traq
Safe HaskellSafe-Inferred
LanguageHaskell2010

Traq.Primitives.Class.QuantumCost

Synopsis

Classical-Quantum Compilation and Cost

class (size ~ SizeType prim, prec ~ PrecType prim, SizeToPrec size prec, TypeCheckPrim prim size) => QuantumHavocCostPrim prim size prec | prim -> size prec where #

Worst-case Quantum query and operation costs of a primitive. Represents one level of the call graph. The quantum compiler of the primitive can use both the quantum and unitary compilation of its function arguments.

Minimal complete definition

Nothing

Methods

quantumQueryCostsQuantum :: prim -> FailProb prec -> PrimFnShape prim prec #

Bound on number of queries made to each function's quantum compilation.

default quantumQueryCostsQuantum :: (Generic prim, GQuantumHavocCostPrim (Rep prim) size prec) => prim -> FailProb prec -> PrimFnShape prim prec #

quantumQueryCostsUnitary :: prim -> FailProb prec -> PrimFnShape prim (UnitaryQueries prec) #

Bound on number of queries made to each function's unitary compilation.

default quantumQueryCostsUnitary :: (Generic prim, GQuantumHavocCostPrim (Rep prim) size prec) => prim -> FailProb prec -> PrimFnShape prim (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => prim -> FailProb prec -> cost #

Cost of all additional operations.

default quantumExprCosts :: (Generic prim, GQuantumHavocCostPrim (Rep prim) size prec, CostModel cost, prec ~ PrecType cost) => prim -> FailProb prec -> cost #

Instances

Instances details
(TypingReqs size, Integral size, Floating prec, SizeToPrec size prec) => QuantumHavocCostPrim (DefaultPrimCollection size prec) size prec # 
Instance details

Defined in Traq.Primitives

(TypingReqs size, SizeToPrec size prec, Floating prec) => QuantumHavocCostPrim (CAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.CAmplify

Methods

quantumQueryCostsQuantum :: CAmplify size prec -> FailProb prec -> PrimFnShape (CAmplify size prec) prec #

quantumQueryCostsUnitary :: CAmplify size prec -> FailProb prec -> PrimFnShape (CAmplify size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => CAmplify size prec -> FailProb prec -> cost #

(TypingReqs size, SizeToPrec size prec, Floating prec) => QuantumHavocCostPrim (QAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.QAmplify

Methods

quantumQueryCostsQuantum :: QAmplify size prec -> FailProb prec -> PrimFnShape (QAmplify size prec) prec #

quantumQueryCostsUnitary :: QAmplify size prec -> FailProb prec -> PrimFnShape (QAmplify size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => QAmplify size prec -> FailProb prec -> cost #

(Integral size, Floating prec, SizeToPrec size prec) => QuantumHavocCostPrim (QMax size prec) size prec # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

quantumQueryCostsQuantum :: QMax size prec -> FailProb prec -> PrimFnShape (QMax size prec) prec #

quantumQueryCostsUnitary :: QMax size prec -> FailProb prec -> PrimFnShape (QMax size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => QMax size prec -> FailProb prec -> cost #

(TypingReqs size, Integral size, Num prec, SizeToPrec size prec) => QuantumHavocCostPrim (DetSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.DetSearch

Methods

quantumQueryCostsQuantum :: DetSearch size prec -> FailProb prec -> PrimFnShape (DetSearch size prec) prec #

quantumQueryCostsUnitary :: DetSearch size prec -> FailProb prec -> PrimFnShape (DetSearch size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => DetSearch size prec -> FailProb prec -> cost #

(TypingReqs size, Integral size, SizeToPrec size prec, Floating prec) => QuantumHavocCostPrim (QSearchCFNW size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

quantumQueryCostsQuantum :: QSearchCFNW size prec -> FailProb prec -> PrimFnShape (QSearchCFNW size prec) prec #

quantumQueryCostsUnitary :: QSearchCFNW size prec -> FailProb prec -> PrimFnShape (QSearchCFNW size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => QSearchCFNW size prec -> FailProb prec -> cost #

(TypingReqs size, Integral size, Floating prec, SizeToPrec size prec) => QuantumHavocCostPrim (RandomSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.RandomSearch

Methods

quantumQueryCostsQuantum :: RandomSearch size prec -> FailProb prec -> PrimFnShape (RandomSearch size prec) prec #

quantumQueryCostsUnitary :: RandomSearch size prec -> FailProb prec -> PrimFnShape (RandomSearch size prec) (UnitaryQueries prec) #

quantumExprCosts :: (CostModel cost, prec ~ PrecType cost) => RandomSearch size prec -> FailProb prec -> cost #

(TypingReqs size, Floating prec, Ord prec, Show prec, SizeToPrec size prec) => QuantumHavocCostPrim (SimonsFindXorPeriod size prec) size prec #

Same as unitary compilation.

Instance details

Defined in Traq.Primitives.Simons.Quantum

(TypingReqs size, Show prec, Num prec, Eq prec) => QuantumHavocCostPrim (QSearchSym size prec) (Sym size) (Sym prec) # 
Instance details

Defined in Traq.Primitives.Search.Symbolic

Methods

quantumQueryCostsQuantum :: QSearchSym size prec -> FailProb (Sym prec) -> PrimFnShape (QSearchSym size prec) (Sym prec) #

quantumQueryCostsUnitary :: QSearchSym size prec -> FailProb (Sym prec) -> PrimFnShape (QSearchSym size prec) (UnitaryQueries (Sym prec)) #

quantumExprCosts :: (CostModel cost, Sym prec ~ PrecType cost) => QSearchSym size prec -> FailProb (Sym prec) -> cost #

class (size ~ SizeType prim, prec ~ PrecType prim, SizeToPrec size prec, TypeCheckPrim prim size) => QuantumExpCostPrim prim size prec where #

Expected Quantum query and operation costs of a primitive. Represents one level of the call graph. The quantum compiler of the primitive can use both the quantum and unitary compilation of its function arguments.

Minimal complete definition

Nothing

Methods

quantumExpQueryCostsQuantum :: forall shape m. (shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

default quantumExpQueryCostsQuantum :: forall shape m. (Generic prim, GQuantumExpCostPrim (Rep prim) size prec) => (shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: forall shape m. (shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

Bound on the expected number of queries made to each function's unitary compilation.

default quantumExpQueryCostsUnitary :: forall shape m. (Generic prim, GQuantumExpCostPrim (Rep prim) size prec) => (shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

Cost of all additional operations. Defaults to zero.

default quantumExpExprCosts :: forall shape cost m. (Generic prim, GQuantumExpCostPrim (Rep prim) size prec) => (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape prim, m ~ EvaluationMonad prec) => prim -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

Instances

Instances details
(EvalReqs size prec, Floating prec, Ord prec) => QuantumExpCostPrim (DefaultPrimCollection size prec) size prec # 
Instance details

Defined in Traq.Primitives

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (DefaultPrimCollection size prec), m ~ EvaluationMonad prec) => DefaultPrimCollection size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (DefaultPrimCollection size prec), m ~ EvaluationMonad prec) => DefaultPrimCollection size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (DefaultPrimCollection size prec), m ~ EvaluationMonad prec) => DefaultPrimCollection size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(EvalReqs size prec, Floating prec, Ord prec) => QuantumExpCostPrim (CAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.CAmplify

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (CAmplify size prec), m ~ EvaluationMonad prec) => CAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (CAmplify size prec), m ~ EvaluationMonad prec) => CAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (CAmplify size prec), m ~ EvaluationMonad prec) => CAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(EvalReqs size prec, Floating prec, Ord prec) => QuantumExpCostPrim (QAmplify size prec) size prec # 
Instance details

Defined in Traq.Primitives.Amplify.QAmplify

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (QAmplify size prec), m ~ EvaluationMonad prec) => QAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (QAmplify size prec), m ~ EvaluationMonad prec) => QAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (QAmplify size prec), m ~ EvaluationMonad prec) => QAmplify size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(Floating prec, Integral size, SizeToPrec size prec) => QuantumExpCostPrim (QMax size prec) size prec # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (QMax size prec), m ~ EvaluationMonad prec) => QMax size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (QMax size prec), m ~ EvaluationMonad prec) => QMax size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (QMax size prec), m ~ EvaluationMonad prec) => QMax size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(size ~ SizeT, Floating prec, Monoidal prec, Semiring prec) => QuantumExpCostPrim (DetSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.DetSearch

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (DetSearch size prec), m ~ EvaluationMonad prec) => DetSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (DetSearch size prec), m ~ EvaluationMonad prec) => DetSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (DetSearch size prec), m ~ EvaluationMonad prec) => DetSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(size ~ SizeT, Floating prec, RVType prec prec) => QuantumExpCostPrim (QSearchCFNW size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (QSearchCFNW size prec), m ~ EvaluationMonad prec) => QSearchCFNW size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (QSearchCFNW size prec), m ~ EvaluationMonad prec) => QSearchCFNW size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (QSearchCFNW size prec), m ~ EvaluationMonad prec) => QSearchCFNW size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #

(size ~ SizeT, Floating prec, Monoidal prec, Semiring prec) => QuantumExpCostPrim (RandomSearch size prec) size prec # 
Instance details

Defined in Traq.Primitives.Search.RandomSearch

Methods

quantumExpQueryCostsQuantum :: (shape ~ PrimFnShape (RandomSearch size prec), m ~ EvaluationMonad prec) => RandomSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape [([Value size], prec)] #

quantumExpQueryCostsUnitary :: (shape ~ PrimFnShape (RandomSearch size prec), m ~ EvaluationMonad prec) => RandomSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> shape (UnitaryQueries prec) #

quantumExpExprCosts :: forall shape cost m. (CostModel cost, prec ~ PrecType cost, shape ~ PrimFnShape (RandomSearch size prec), m ~ EvaluationMonad prec) => RandomSearch size prec -> FailProb prec -> shape ([Value size] -> m [Value size]) -> cost #