44 std::unique_ptr<QcsimPauliPropagator>
Clone()
const
46 auto clone = std::make_unique<QcsimPauliPropagator>();
47 clone->SetNrQubits(GetNrQubits());
48 clone->SetPauliWeightThreshold(GetPauliWeightThreshold());
49 clone->SetBatchSize(GetBatchSize());
50 clone->SetBatchSizeForSum(GetBatchSizeForSum());
51 clone->SetCoefficientThreshold(GetCoefficientThreshold());
52 clone->SetParallelThreshold(GetParallelThreshold());
53 clone->SetParallelThresholdForSum(GetParallelThresholdForSum());
54 clone->SetStepsBetweenDeduplication(StepsBetweenDeduplication());
55 clone->SetStepsBetweenTrims(StepsBetweenTrims());
57 clone->ShareOperationsFrom(*
this);
59 clone->SetSavePosition(GetSavePosition());
61 clone->SetSamplingCacheMaxNodes(GetSamplingCacheMaxNodes());
62 if (IsParallelEnabled())
63 clone->EnableParallel(GetThreadCount());
83 double doublingCost = 1;
88 for (
int pos =
static_cast<int>(circuit->size()) - 1; pos >= 0; --pos)
90 const std::shared_ptr<Circuits::IOperation<>> &op = (*circuit)[pos];
91 cost += GetOpCost(circuit, op, pos) * doublingCost;
92 doublingCost *= GetOpMultiplication(op);