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 sizeT, Floating precT, SizeToPrec sizeT precT) => QuantumHavocCostPrim (QMax sizeT precT) sizeT precT # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

quantumQueryCostsQuantum :: QMax sizeT precT -> FailProb precT -> PrimFnShape (QMax sizeT precT) precT #

quantumQueryCostsUnitary :: QMax sizeT precT -> FailProb precT -> PrimFnShape (QMax sizeT precT) (UnitaryQueries precT) #

quantumExprCosts :: (CostModel cost, precT ~ PrecType cost) => QMax sizeT precT -> FailProb precT -> 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 sizeT, Integral sizeT, SizeToPrec sizeT precT, Floating precT) => QuantumHavocCostPrim (QSearchCFNW sizeT precT) sizeT precT # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

quantumQueryCostsQuantum :: QSearchCFNW sizeT precT -> FailProb precT -> PrimFnShape (QSearchCFNW sizeT precT) precT #

quantumQueryCostsUnitary :: QSearchCFNW sizeT precT -> FailProb precT -> PrimFnShape (QSearchCFNW sizeT precT) (UnitaryQueries precT) #

quantumExprCosts :: (CostModel cost, precT ~ PrecType cost) => QSearchCFNW sizeT precT -> FailProb precT -> 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

(Eq sizeT, Num sizeT, Num precT, Show sizeT, Show precT, Num precT, Eq precT) => QuantumHavocCostPrim (QSearchSym sizeT precT) (Sym sizeT) (Sym precT) # 
Instance details

Defined in Traq.Primitives.Search.Symbolic

Methods

quantumQueryCostsQuantum :: QSearchSym sizeT precT -> FailProb (Sym precT) -> PrimFnShape (QSearchSym sizeT precT) (Sym precT) #

quantumQueryCostsUnitary :: QSearchSym sizeT precT -> FailProb (Sym precT) -> PrimFnShape (QSearchSym sizeT precT) (UnitaryQueries (Sym precT)) #

quantumExprCosts :: (CostModel cost, Sym precT ~ PrecType cost) => QSearchSym sizeT precT -> FailProb (Sym precT) -> 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) => 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 precT, Integral sizeT, SizeToPrec sizeT precT) => QuantumExpCostPrim (QMax sizeT precT) sizeT precT # 
Instance details

Defined in Traq.Primitives.Max.QMax

Methods

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

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

quantumExpExprCosts :: forall shape cost m. (CostModel cost, precT ~ PrecType cost, shape ~ PrimFnShape (QMax sizeT precT), m ~ EvaluationMonad precT) => QMax sizeT precT -> FailProb precT -> shape ([Value sizeT] -> m [Value sizeT]) -> 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 #

(sizeT ~ SizeT, Floating precT, RVType precT precT) => QuantumExpCostPrim (QSearchCFNW sizeT precT) sizeT precT # 
Instance details

Defined in Traq.Primitives.Search.QSearchCFNW

Methods

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

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

quantumExpExprCosts :: forall shape cost m. (CostModel cost, precT ~ PrecType cost, shape ~ PrimFnShape (QSearchCFNW sizeT precT), m ~ EvaluationMonad precT) => QSearchCFNW sizeT precT -> FailProb precT -> shape ([Value sizeT] -> m [Value sizeT]) -> 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 #