|
Maestro 0.2.5
Unified interface for quantum circuit simulation
|
Circuit class for holding the sequence of operations that can be compared with another circuit. More...
#include <Circuit.h>
Inheritance diagram for Circuits::ComparableCircuit< Time >:
Collaboration diagram for Circuits::ComparableCircuit< Time >:Public Types | |
| using | allocator_type = typename OperationsVector::allocator_type |
| using | BaseClass = Circuit< Time > |
| The base class type. | |
| using | BitMapping = std::unordered_map< Types::qubit_t, Types::qubit_t > |
| The (qu)bit mapping for remapping. | |
| using | const_iterator = typename OperationsVector::const_iterator |
| using | const_pointer = typename OperationsVector::const_pointer |
| using | const_reference = typename OperationsVector::const_reference |
| using | const_reverse_iterator = typename OperationsVector::const_reverse_iterator |
| using | difference_type = typename OperationsVector::difference_type |
| using | ExecuteResults = std::unordered_map< std::vector< bool >, size_t > |
| The results of the execution of the circuit. | |
| using | iterator = typename OperationsVector::iterator |
| using | Operation = IOperation< Time > |
| The operation type. | |
| using | OperationPtr = std::shared_ptr< Operation > |
| The shared pointer to the operation type. | |
| using | OperationsVector = std::vector< OperationPtr > |
| The vector of operations. | |
| using | pointer = typename OperationsVector::pointer |
| using | reference = typename OperationsVector::reference |
| using | reverse_iterator = typename OperationsVector::reverse_iterator |
| using | size_type = typename OperationsVector::size_type |
| using | value_type = typename OperationsVector::value_type |
Public Member Functions | |
| ComparableCircuit (const BaseClass &circ) | |
| Construct a new ComparableCircuit object. | |
| ComparableCircuit (const OperationsVector &ops={}) | |
| Construct a new ComparableCircuit object. | |
| bool | ActsOnlyOnAdjacentQubits () const |
| Checks if the circuit has only operations that act on adjacent qubits. | |
| void | AddCircuit (const std::shared_ptr< Circuit< Time > > &circuit) |
| Adds operations from another circuit to the circuit. | |
| void | AddOperation (const OperationPtr &op) |
| Adds an operation to the circuit. | |
| void | AddOperations (const OperationsVector &ops) |
| Adds operations to the circuit. | |
| void | AddResetsAtBeginningIfNeeded (Time delay=0) |
| Add resets at the beginning of the circuit. | |
| void | AddResetsIfNeeded (Time delay=0) |
| Add resets at the end of the circuit. | |
| std::vector< size_t > | AffectedBits () const override |
| Returns the affected bits. | |
| Types::qubits_vector | AffectedQubits () const override |
| Returns the affected qubits. | |
| iterator | begin () noexcept |
| Get the begin iterator for the operations. | |
| bool | CanAffectQuantumState () const override |
| Find if the circuit can affect the quantum state. | |
| const_iterator | cbegin () const noexcept |
| Get the const begin iterator for the operations. | |
| const_iterator | cend () const noexcept |
| Get the const end iterator for the operations. | |
| void | Clear () |
| Clears the operations from the circuit. | |
| double | CliffordPercentage () const |
| Get the percentage of Clifford operations in the circuit. | |
| OperationPtr | Clone () const override |
| Get a shared pointer to a clone of this object. | |
| OperationPtr | CloneFlyweight () const |
| Get a shared pointer to a clone of this object, but without cloning the operations. | |
| void | ConvertForCutting () |
| Converts the circuit for distributed computing. | |
| void | ConvertForDistribution () |
| Converts the circuit for distributed computing. | |
| const_reverse_iterator | crbegin () const noexcept |
| Get the const reverse begin iterator for the operations. | |
| const_reverse_iterator | crend () const noexcept |
| Get the const reverse end iterator for the operations. | |
| auto | empty () const |
| Check if the circuit is empty. | |
| iterator | end () noexcept |
| Get the end iterator for the operations. | |
| void | EnsureProperOrderForMeasurements () |
| void | Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override |
| Execute the circuit on the given simulator. | |
| void | ExecuteMeasurements (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state, const std::vector< bool > &executedOps) const |
| Execute the measurement operations from the circuit on the given simulator. | |
| std::vector< bool > | ExecuteNonMeasurements (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const |
| Execute the non-measurements operations from the circuit on the given simulator. | |
| bool | GetApproximateParamsCheck () const |
| Gets whether to check approximate equality of gate parameters. | |
| std::set< size_t > | GetBits () const |
| Returns the classical bits affected by the operations. | |
| std::shared_ptr< Circuit< Time > > | GetCircuitCut (Types::qubit_t startQubit, Types::qubit_t endQubit) const |
| Get the circuit cut. | |
| std::unordered_set< Types::qubit_t > | GetCliffordQubits () const |
| Get the qubits that are acted on by Clifford operations. | |
| Time | GetDelay () const |
| Get the delay of the operation. | |
| std::pair< std::vector< size_t >, std::vector< Time > > | GetDepth () const |
| Get circuit depth. | |
| std::unordered_map< size_t, OperationPtr > | GetFirstOperationsOnQubits () const |
| Returns the first operations on circuit's qubits. | |
| std::shared_ptr< MeasurementOperation< Time > > | GetLastMeasurements (const std::vector< bool > &executedOps, bool sort=true) const |
| std::unordered_map< size_t, OperationPtr > | GetLastOperationsOnQubits () const |
| Returns the last operations on circuit's qubits. | |
| size_t | GetMaxCbitIndex () const |
| Returns the max classical bit id for all operations. | |
| std::pair< size_t, Time > | GetMaxDepth () const |
| Get max circuit depth. | |
| size_t | GetMaxQubitIndex () const |
| Returns the max qubit id for all operations. | |
| size_t | GetMinCbitIndex () const |
| Returns the min classical bit id for all operations. | |
| size_t | GetMinQubitIndex () const |
| Returns the min qubit id for all operations. | |
| size_t | GetNumberOfOperations () const |
| Get the number of operations in the circuit. | |
| OperationPtr | GetOperation (size_t pos) const |
| Get an operation at a given position. | |
| const OperationsVector & | GetOperations () const |
| Get the operations in the circuit. | |
| double | GetParamsEpsilon () const |
| Gets the epsilon used for checking approximate equality of gate parameters. | |
| std::shared_ptr< IOperation< Time > > | getptr () |
| Get a shared pointer to this object. | |
| std::set< size_t > | GetQubits () const |
| Returns the qubits affected by the operations. | |
| OperationType | GetType () const override |
| Get the type of the circuit. | |
| bool | HasConditionalOperations () const |
| Checks if the circuit has clasically conditional operations. | |
| bool | HasOpsAfterMeasurements () const |
| Checks if the circuit has measurements that are followed by operations that affect the measured qubits. | |
| bool | IsClifford () const override |
| Checks if the circuit is a Clifford circuit. | |
| virtual bool | IsConditional () const |
| Find if the operation is a conditional operation. | |
| bool | IsForest () const |
| Checks if the circuit is a forest circuit. | |
| void | MoveMeasurementsAndResets () |
| Move the measurements and resets closer to the beginning of the circuit. | |
| bool | NeedsEntanglementForDistribution () const override |
| Find if the circuit needs entanglement for distribution. | |
| bool | operator!= (const BaseClass &rhs) const |
| Comparison operator. | |
| ComparableCircuit & | operator= (const BaseClass &circ) |
| Assignment operator. | |
| bool | operator== (const BaseClass &rhs) const |
| Comparison operator. | |
| auto & | operator[] (size_t pos) |
| Get the operation at a given position. | |
| const auto & | operator[] (size_t pos) const |
| Get the operation at a given position. | |
| void | Optimize (bool optimizeRotationGates=true) |
| Circuit optimization. | |
| reverse_iterator | rbegin () noexcept |
| Get the reverse begin iterator for the operations. | |
| OperationPtr | Remap (const BitMapping &qubitsMap, const BitMapping &bitsMap={}) const override |
| Get a shared pointer to a circuit remapped. | |
| virtual std::shared_ptr< IOperation< Time > > | Remap (const std::unordered_map< Types::qubit_t, Types::qubit_t > &qubitsMap, const std::unordered_map< Types::qubit_t, Types::qubit_t > &bitsMap={}) const =0 |
| Get a shared pointer to a remapped operation. | |
| std::shared_ptr< Circuit< Time > > | RemapToContinuous (BitMapping &newQubitsMap, BitMapping &reverseBitsMap, size_t &nrQubits, size_t &nrCbits) const |
| Get a shared pointer to a circuit remapped to a continuous interval starting from zero. | |
| reverse_iterator | rend () noexcept |
| Get the reverse end iterator for the operations. | |
| void | ReplaceOperation (size_t index, const OperationPtr &op) |
| Replaces an operation in the circuit. | |
| void | resize (size_t size) |
| Resizes the circuit. | |
| void | SetApproximateParamsCheck (bool check) |
| Sets whether to check approximate equality of gate parameters. | |
| void | SetDelay (Time d) |
| Set the delay of the operation. | |
| void | SetOperations (const OperationsVector &ops) |
| Set the operations in the circuit. | |
| void | SetParamsEpsilon (double eps) |
| Sets the epsilon used for checking approximate equality of gate parameters. | |
| auto | size () const |
| Get the number of operations in the circuit. | |
| std::vector< std::shared_ptr< Circuit< Time > > > | SplitCircuit () const |
| Splits a circuit that has disjoint subcircuits in it into separate circuits. | |
| std::vector< std::shared_ptr< Circuits::Circuit< Time > > > | ToLayers () const |
| Converts the circuit to layers. | |
| std::vector< std::shared_ptr< Circuits::Circuit< Time > > > | ToLayersNoClone () const |
| Converts the circuit to layers. | |
| std::vector< std::shared_ptr< Circuits::Circuit< Time > > > | ToMultipleQubitsLayers () const |
| Converts the circuit to layers oriented on multiple qubit gates. | |
| std::vector< std::shared_ptr< Circuits::Circuit< Time > > > | ToMultipleQubitsLayersNoClone () const |
| Converts the circuit to layers oriented on multiple qubit gates. | |
Static Public Member Functions | |
| static void | AccumulateResults (ExecuteResults &results, const ExecuteResults &newResults) |
| Accumulate the results of a circuit execution to already existing results. | |
| static void | AccumulateResultsWithRemapBack (ExecuteResults &results, const ExecuteResults &newResults, const BitMapping &bitsMap={}, bool ignoreNotMapped=true, size_t sz=0) |
| Accumulate the results of a circuit execution to already existing results with remapping. | |
| static std::shared_ptr< Circuits::Circuit< Time > > | LayersToCircuit (const std::vector< std::shared_ptr< Circuits::Circuit< Time > > > &layers) |
| Converts the layers back to a circuit. | |
| static ExecuteResults | RemapResultsBack (const ExecuteResults &results, const BitMapping &bitsMap={}, bool ignoreNotMapped=false, size_t sz=0) |
| Map back the results for a remapped circuit. | |
Circuit class for holding the sequence of operations that can be compared with another circuit.
Contains a sequence of operations that can be executed, supplying a function that allows executing them in a simulator. Allows adding operations and converting them to prepare the circuit for distributed computing.
| Time | The time type used for operation timing. |
|
inherited |
| using Circuits::ComparableCircuit< Time >::BaseClass = Circuit<Time> |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
| using Circuits::ComparableCircuit< Time >::Operation = IOperation<Time> |
| using Circuits::ComparableCircuit< Time >::OperationPtr = std::shared_ptr<Operation> |
| using Circuits::ComparableCircuit< Time >::OperationsVector = std::vector<OperationPtr> |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inline |
Construct a new ComparableCircuit object.
Constructs a new ComparableCircuit object with the given operations.
| ops | The operations to add to the circuit. |
|
inline |
Construct a new ComparableCircuit object.
Constructs a new ComparableCircuit object with the given Circuit.
| circuit | The circuit from where to add the operations to the comparable circuit. |
|
inlinestaticinherited |
Accumulate the results of a circuit execution to already existing results.
Accumulates the results of a circuit execution to already existing results.
| results | The existing results to accumulate to. |
| newResults | The new results to add to the existing results. |
|
inlinestaticinherited |
Accumulate the results of a circuit execution to already existing results with remapping.
Accumulates the results of a circuit execution to already existing results with remapping back.
| results | The existing results to accumulate to. |
| newResults | The new results to add to the existing results. |
| bitsMap | The map of classical bits to remap. |
| ignoreNotMapped | If true, the results that are not in the map will be ignored. |
| sz | The size of the results vector. |
|
inlineinherited |
Checks if the circuit has only operations that act on adjacent qubits.
Checks if the circuit has only operations that act on adjacent qubits. Can be useful in picking up a tensor network contractor, for example. Also such a circuit is easier to simulate in a MPS simulator, since swap gates are not needed to be added to bring up the qubits next to each other before applying a two qubits gate.
|
inlineinherited |
Adds operations from another circuit to the circuit.
Adds operations from another circuit to the circuit.
| circuit | The circuit to add operations from. |
Definition at line 162 of file Circuit.h.
References Circuits::Circuit< Time >::AddOperations().
|
inlineinherited |
Adds an operation to the circuit.
Adds an operation to the circuit.
| op | The operation to add. |
Definition at line 121 of file Circuit.h.
Referenced by Circuits::ComparableCircuit< Time >::operator==().
|
inlineinherited |
Adds operations to the circuit.
Adds operations to the circuit.
| ops | The operations to add. |
Definition at line 152 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::AddCircuit().
|
inlineinherited |
Add resets at the beginning of the circuit.
Adds resets at the beginning of the circuit, on the qubits that don't have a reset operation already.
| delay | The delay for the reset operation |
Definition at line 737 of file Circuit.h.
References Circuits::Circuit< Time >::GetFirstOperationsOnQubits(), and Circuits::kReset.
|
inlineinherited |
Add resets at the end of the circuit.
Adds resets at the end of the circuit, on the qubits that don't have a reset operation already.
| delay | The delay for the reset operation |
Definition at line 718 of file Circuit.h.
References Circuits::Circuit< Time >::GetLastOperationsOnQubits(), and Circuits::kReset.
|
inlineoverridevirtualinherited |
Returns the affected bits.
Returns the affected classical bits.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 631 of file Circuit.h.
References Circuits::Circuit< Time >::GetBits().
Referenced by Circuits::ComparableCircuit< Time >::operator==().
|
inlineoverridevirtualinherited |
Returns the affected qubits.
Returns the affected qubits by the operation.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 614 of file Circuit.h.
References Circuits::Circuit< Time >::GetQubits().
Referenced by Circuits::ComparableCircuit< Time >::operator==(), and Circuits::Circuit< Time >::SplitCircuit().
|
inlinenoexceptinherited |
Get the begin iterator for the operations.
Returns the begin iterator for the operations.
Definition at line 2302 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::SplitCircuit().
|
inlineoverridevirtualinherited |
Find if the circuit can affect the quantum state.
Returns true if the circuit can affect the quantum state, false otherwise.
Reimplemented from Circuits::IOperation< Time >.
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inlineinherited |
Get the percentage of Clifford operations in the circuit.
Returns the percentage of Clifford operations in the circuit. Considers gates as Clifford if they are supported by the Clifford simulator.
|
inlineoverridevirtualinherited |
Get a shared pointer to a clone of this object.
Returns a shared pointer to a copy of this object.
Implements Circuits::IOperation< Time >.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
Definition at line 420 of file Circuit.h.
References Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kConditionalRandomGen, and Circuits::kMeasurement.
|
inlineoverridevirtualinherited |
Execute the circuit on the given simulator.
Executes the circuit on the given simulator.
| sim | The simulator to execute the circuit on. |
| state | The classical state containing the classical bits. |
Implements Circuits::IOperation< Time >.
Definition at line 96 of file Circuit.h.
References Circuits::OperationState::Reset().
|
inlineinherited |
Execute the measurement operations from the circuit on the given simulator.
Execute the measurements operations from the circuit on the given simulator.
| sim | The simulator to execute the circuit on. |
| state | The classical state containing the classical bits. |
Definition at line 1774 of file Circuit.h.
References Circuits::OperationState::Reset().
|
inlineinherited |
Execute the non-measurements operations from the circuit on the given simulator.
Execute the non-measurements operations from the circuit on the given simulator.
| sim | The simulator to execute the circuit on. |
| state | The classical state containing the classical bits. |
Definition at line 1677 of file Circuit.h.
References Circuits::kConditionalMeasurement, Circuits::kConditionalRandomGen, Circuits::kGate, Circuits::kMeasurement, Circuits::kRandomGen, and Circuits::kReset.
|
inline |
|
inlineinherited |
Returns the classical bits affected by the operations.
Returns the classical bits affected by the operations.
Definition at line 598 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::AffectedBits().
|
inlineinherited |
Get the circuit cut.
Cuts out a circuit from the current circuit, starting from the startQubit and ending at the endQubit. Throws an exception if there is an operation that affects both qubits inside and outside of the specified interval. The returned circuit contains only operations that act on the qubits in the specified interval.
| startQubit | The start qubit of the interval. |
| endQubit | The end qubit of the interval. |
|
inlineinherited |
Get the qubits that are acted on by Clifford operations.
Returns the qubits that are acted on only by Clifford operations. Considers gates as Clifford if they are supported by the Clifford simulator.
|
inlineinherited |
Get the delay of the operation.
Returns the delay due of the execution time of the operation.
Definition at line 497 of file Operations.h.
Referenced by Circuits::ConditionalGate< Time >::Clone(), Circuits::MeasurementOperation< Time >::Clone(), Circuits::NoOperation< Time >::Clone(), Circuits::PhaseGate< Time >::Clone(), Circuits::XGate< Time >::Clone(), Circuits::YGate< Time >::Clone(), Circuits::ZGate< Time >::Clone(), Circuits::HadamardGate< Time >::Clone(), Circuits::SGate< Time >::Clone(), Circuits::SdgGate< Time >::Clone(), Circuits::TGate< Time >::Clone(), Circuits::TdgGate< Time >::Clone(), Circuits::SxGate< Time >::Clone(), Circuits::SxDagGate< Time >::Clone(), Circuits::KGate< Time >::Clone(), Circuits::RxGate< Time >::Clone(), Circuits::RyGate< Time >::Clone(), Circuits::RzGate< Time >::Clone(), Circuits::UGate< Time >::Clone(), Circuits::SwapGate< Time >::Clone(), Circuits::CXGate< Time >::Clone(), Circuits::CYGate< Time >::Clone(), Circuits::CZGate< Time >::Clone(), Circuits::CPGate< Time >::Clone(), Circuits::CRxGate< Time >::Clone(), Circuits::CRyGate< Time >::Clone(), Circuits::CRzGate< Time >::Clone(), Circuits::CHGate< Time >::Clone(), Circuits::CSxGate< Time >::Clone(), Circuits::CSxDagGate< Time >::Clone(), Circuits::CUGate< Time >::Clone(), Circuits::CCXGate< Time >::Clone(), Circuits::CSwapGate< Time >::Clone(), Circuits::Random< Time >::Clone(), Circuits::Reset< Time >::Clone(), and Circuits::ComparableCircuit< Time >::operator==().
|
inlineinherited |
Get circuit depth.
Returns the depth of the circuit as a pair of the depth and an estimate of time cost for each qubit. Should be considered only as an estimate.
Definition at line 1414 of file Circuit.h.
References Circuits::Circuit< Time >::GetMaxQubitIndex(), Circuits::kConditionalGate, Circuits::kConditionalMeasurement, and Circuits::kMeasurement.
Referenced by Circuits::Circuit< Time >::GetMaxDepth().
|
inlineinherited |
Returns the first operations on circuit's qubits.
Returns the first operations on circuit's qubits.
Definition at line 697 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::AddResetsAtBeginningIfNeeded().
|
inlineinherited |
Definition at line 1793 of file Circuit.h.
References Circuits::Circuit< Time >::GetType(), and Circuits::kMeasurement.
|
inlineinherited |
Returns the last operations on circuit's qubits.
Returns the last operations on circuit's qubits.
Definition at line 679 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::AddResetsIfNeeded().
|
inlineinherited |
Returns the max classical bit id for all operations.
Returns the max classical bit id for all operations.
Definition at line 543 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::MoveMeasurementsAndResets().
|
inlineinherited |
Get max circuit depth.
Returns the max depth of the circuit as a pair of the max depth and an estimate of max time cost. Should be considered only as an estimate.
Definition at line 1514 of file Circuit.h.
References Circuits::Circuit< Time >::GetDepth().
|
inlineinherited |
Returns the max qubit id for all operations.
Returns the max qubit id for all operations.
Definition at line 507 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::GetDepth(), and Circuits::Circuit< Time >::MoveMeasurementsAndResets().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Get an operation at a given position.
Returns the operation at the given position.
| pos | The position of the operation to get. |
Definition at line 1543 of file Circuit.h.
Referenced by Circuits::ComparableCircuit< Time >::operator==().
|
inlineinherited |
Get the operations in the circuit.
Returns the operations in the circuit.
Definition at line 173 of file Circuit.h.
Referenced by Circuits::ComparableCircuit< Time >::operator=(), Circuits::ComparableCircuit< Time >::operator==(), Circuits::Circuit< Time >::ToLayers(), Circuits::Circuit< Time >::ToLayersNoClone(), Circuits::Circuit< Time >::ToMultipleQubitsLayers(), and Circuits::Circuit< Time >::ToMultipleQubitsLayersNoClone().
|
inline |
|
inlineinherited |
Get a shared pointer to this object.
Returns a shared pointer to this object. The object needs to be already wrapped in a shared pointer.
Definition at line 487 of file Operations.h.
|
inlineinherited |
Returns the qubits affected by the operations.
Returns the qubits affected by the operations. They might not cover all qubits, there might be gaps. In such cases a remapping might be needed, for example in a scheduler.
Definition at line 581 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::AffectedQubits(), and Circuits::Circuit< Time >::SplitCircuit().
|
inlineoverridevirtualinherited |
Get the type of the circuit.
Returns the type of the circuit.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 112 of file Circuit.h.
References Circuits::kComposite.
Referenced by Circuits::Circuit< Time >::GetLastMeasurements().
|
inlineinherited |
Checks if the circuit has clasically conditional operations.
Checks if the circuit has clasically conditional operations.
Definition at line 1828 of file Circuit.h.
References Circuits::kConditionalGate, Circuits::kConditionalMeasurement, and Circuits::kConditionalRandomGen.
|
inlineinherited |
Checks if the circuit has measurements that are followed by operations that affect the measured qubits.
Checks if the circuit has measurements that are followed by operations that affect the measured qubits.
Definition at line 1602 of file Circuit.h.
References Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kConditionalRandomGen, Circuits::kMeasurement, Circuits::kRandomGen, and Circuits::kReset.
|
inlineoverridevirtualinherited |
Checks if the circuit is a Clifford circuit.
Checks if the circuit is a Clifford circuit. Considers gates as Clifford if they are supported by the Clifford simulator.
Reimplemented from Circuits::IOperation< Time >.
|
inlinevirtualinherited |
Find if the operation is a conditional operation.
Returns true if the operation is conditional, false otherwise.
Definition at line 458 of file Operations.h.
References Circuits::IOperation< Time >::GetType(), Circuits::kConditionalGate, Circuits::kConditionalMeasurement, and Circuits::kConditionalRandomGen.
|
inlineinherited |
|
inlinestaticinherited |
Converts the layers back to a circuit.
The layers are converted back to a circuit by joining the individual circuits into a single one.
| layers | The layers to convert. |
|
inlineinherited |
Move the measurements and resets closer to the beginning of the circuit.
Moves the measurements and resets closer to the beginning of the circuit.
Definition at line 1278 of file Circuit.h.
References Circuits::Circuit< Time >::GetMaxCbitIndex(), Circuits::Circuit< Time >::GetMaxQubitIndex(), Circuits::kMeasurement, Circuits::kReset, and Circuits::Circuit< Time >::size().
|
inlineoverridevirtualinherited |
Find if the circuit needs entanglement for distribution.
Returns true if the circuit needs entanglement for distribution, false otherwise.
Reimplemented from Circuits::IOperation< Time >.
|
inline |
|
inline |
Assignment operator.
Assigns the operations from the given circuit to this circuit.
| circ | The circuit from where to add the operations to this circuit. |
Definition at line 2607 of file Circuit.h.
References Circuits::Circuit< Time >::GetOperations(), and Circuits::Circuit< Time >::SetOperations().
|
inline |
Comparison operator.
Compares two circuits for equality.
| rhs | The circuit to compare to. |
Definition at line 2619 of file Circuit.h.
References Circuits::Circuit< Time >::AddOperation(), Circuits::Circuit< Time >::AffectedBits(), Circuits::Circuit< Time >::AffectedQubits(), Circuits::IOperation< Time >::GetDelay(), Circuits::IQuantumGate< Time >::GetGateType(), Circuits::Circuit< Time >::GetOperation(), Circuits::Circuit< Time >::GetOperations(), Circuits::IQuantumGate< Time >::GetParams(), Circuits::Reset< Time >::GetResetTargets(), Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kConditionalRandomGen, Circuits::kGate, Circuits::kMeasurement, Circuits::kNoOp, Circuits::kRandomGen, Circuits::kReset, Circuits::ComparableCircuit< Time >::SetApproximateParamsCheck(), and Circuits::Circuit< Time >::size().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Circuit optimization.
Optimizes the circuit. See qisikit aer for 'transpilling' when the circuit is flushed for some ideas.
Definition at line 756 of file Circuit.h.
References Circuits::kCCXGateType, Circuits::kCHGateType, Circuits::kCPGateType, Circuits::kCRxGateType, Circuits::kCRyGateType, Circuits::kCRzGateType, Circuits::kCSwapGateType, Circuits::kCSxDagGateType, Circuits::kCSxGateType, Circuits::kCXGateType, Circuits::kCYGateType, Circuits::kCZGateType, Circuits::kGate, Circuits::kHadamardGateType, Circuits::kKGateType, Circuits::kNoOp, Circuits::kPhaseGateType, Circuits::kRxGateType, Circuits::kRyGateType, Circuits::kRzGateType, Circuits::kSdgGateType, Circuits::kSGateType, Circuits::kSwapGateType, Circuits::kSxDagGateType, Circuits::kSxGateType, Circuits::kTdgGateType, Circuits::kTGateType, Circuits::kXGateType, Circuits::kYGateType, and Circuits::kZGateType.
|
inlinenoexceptinherited |
|
inlineoverrideinherited |
Get a shared pointer to a circuit remapped.
Returns a shared pointer to a copy of the circuit with qubits and classical bits changed according to the provided maps.
| qubitsMap | The map of qubits to remap. |
| bitsMap | The map of classical bits to remap. |
|
pure virtualinherited |
Get a shared pointer to a remapped operation.
Returns a shared pointer to a copy of the operation with qubits and classical bits changed according to the provided maps.
| qubitsMap | The map of qubits to remap. |
| bitsMap | The map of classical bits to remap. |
Implemented in Circuits::NoOperation< Time >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, Circuits::TwoQubitsGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::Random< Time >, and Circuits::Reset< Time >.
|
inlinestaticinherited |
Map back the results for a remapped circuit.
Maps back the results for a remapped circuit, using the provided map. The results are the results of the execution of the circuit without remapping.
| results | The results to map back. |
| bitsMap | The map of classical bits to remap. |
| ignoreNotMapped | If true, the results that are not in the map will be ignored. |
| sz | The size of the results vector. |
|
inlineinherited |
Get a shared pointer to a circuit remapped to a continuous interval starting from zero.
Returns a shared pointer to a copy of the circuit with qubits and classical bits changed according to the provided maps.
| bitsMap | The map of classical bits, to allow remapping the results back to the original circuit results. |
|
inlinenoexceptinherited |
|
inlineinherited |
Replaces an operation in the circuit.
Replaces an operation in the circuit.
| index | The index of the operation to replace. |
| op | The operation to replace with. |
|
inlineinherited |
Resizes the circuit.
Resizes the circuit, but it cannot make it larger, only smaller, by removing the last operations.
| size | The new size of the circuit. |
Definition at line 2403 of file Circuit.h.
References Circuits::Circuit< Time >::size().
|
inline |
Sets whether to check approximate equality of gate parameters.
Sets whether to check approximate equality of gate parameters.
| check | Whether to check approximate equality of gate parameters. |
Definition at line 2752 of file Circuit.h.
Referenced by Circuits::ComparableCircuit< Time >::operator==().
|
inlineinherited |
Set the delay of the operation.
Sets the delay due of the execution time of the operation.
| d | The delay of the operation. |
Definition at line 505 of file Operations.h.
|
inlineinherited |
Set the operations in the circuit.
Sets the operations in the circuit.
| ops | The operations to set. |
Definition at line 143 of file Circuit.h.
Referenced by Circuits::ComparableCircuit< Time >::operator=().
|
inline |
|
inlineinherited |
Get the number of operations in the circuit.
Returns the number of operations in the circuit.
Definition at line 2368 of file Circuit.h.
Referenced by Circuits::Circuit< Time >::MoveMeasurementsAndResets(), Circuits::ComparableCircuit< Time >::operator==(), and Circuits::Circuit< Time >::resize().
|
inlineinherited |
Splits a circuit that has disjoint subcircuits in it into separate circuits.
Splits a circuit that has disjoint subcircuits in it into separate circuits.
Definition at line 1996 of file Circuit.h.
References Circuits::Circuit< Time >::AffectedQubits(), Circuits::Circuit< Time >::begin(), and Circuits::Circuit< Time >::GetQubits().
|
inlineinherited |
Converts the circuit to layers.
The circuit is split in layers, each layer being a separate circuit. Operations are cloned.
Definition at line 2094 of file Circuit.h.
References Circuits::Circuit< Time >::GetOperations().
|
inlineinherited |
Converts the circuit to layers.
The circuit is split in layers, each layer being a separate circuit. Operations are not cloned, the shared pointers point to the same operations as the ones from the circuit.
Definition at line 2140 of file Circuit.h.
References Circuits::Circuit< Time >::GetOperations().
|
inlineinherited |
Converts the circuit to layers oriented on multiple qubit gates.
The circuit is split in layers, each layer being a separate circuit. Operations are cloned. It's not as ToLayers above, the order of the operations in a layer matters. If the one qubit gates would be contracted into the ones on more than one qubit, then it would be the situation of normal layers.
Definition at line 2189 of file Circuit.h.
References Circuits::Circuit< Time >::GetOperations().
|
inlineinherited |
Converts the circuit to layers oriented on multiple qubit gates.
The circuit is split in layers, each layer being a separate circuit. Operations are not cloned. It's not as ToLayers above, the order of the operations in a layer matters. If the one qubit gates would be contracted into the ones on more than one qubit, then it would be the situation of normal layers.
Definition at line 2239 of file Circuit.h.
References Circuits::Circuit< Time >::GetOperations().