|
Maestro 0.2.5
Unified interface for quantum circuit simulation
|
A conditional random generator. More...
#include <Conditional.h>
Inheritance diagram for Circuits::ConditionalRandomGen< Time >:
Collaboration diagram for Circuits::ConditionalRandomGen< Time >:Public Member Functions | |
| ConditionalRandomGen (const std::shared_ptr< Random< Time > > &operation, const std::shared_ptr< ICondition > &condition, Time delay=0) | |
| Construct a new ConditionalRandomGen object. | |
| std::vector< size_t > | AffectedBits () const override |
| Get bits that are involved in the condition. | |
| Types::qubits_vector | AffectedQubits () const override |
| Get the quantum bits affected by the operation. | |
| virtual bool | CanAffectQuantumState () const |
| Find if the operation can affect the quantum state. | |
| std::shared_ptr< IOperation< Time > > | Clone () const override |
| Get a shared pointer to a clone of this object. | |
| void | Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override |
| Execute the operation. | |
| std::shared_ptr< ICondition > | GetCondition () const |
| Get the condition for the conditional operation. | |
| Time | GetDelay () const |
| Get the delay of the operation. | |
| std::shared_ptr< IOperation< Time > > | GetOperation () const |
| Get the operation for the conditional operation. | |
| std::shared_ptr< IOperation< Time > > | getptr () |
| Get a shared pointer to this object. | |
| OperationType | GetType () const override |
| Get the type of the operation. | |
| bool | IsClifford () const override |
| Checks if the operation is a Clifford one. | |
| virtual bool | IsConditional () const |
| Find if the operation is a conditional operation. | |
| virtual bool | NeedsEntanglementForDistribution () const |
| Find if the operation needs entanglement for distribution. | |
| 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 override |
| Get a shared pointer to a remapped operation. | |
| void | SetCondition (const std::shared_ptr< ICondition > &cond) |
| Set the condition for the conditional operation. | |
| void | SetDelay (Time d) |
| Set the delay of the operation. | |
| void | SetOperation (const std::shared_ptr< IOperation< Time > > &op) |
| Set the operation for the conditional operation. | |
A conditional random generator.
A random generator that is executed only if a condition is met.
| Time | The type of the time parameter that is used for operations timing. |
Definition at line 499 of file Conditional.h.
|
inline |
Construct a new ConditionalRandomGen object.
Construct a new ConditionalRandomGen object with the given random generator, condition and delay.
| operation | The random generator to execute if the condition is met. |
| condition | The condition to check. |
| delay | The time required for the operation to complete. |
Definition at line 513 of file Conditional.h.
|
inlineoverridevirtualinherited |
Get bits that are involved in the condition.
Get the classical bits that are involved in the condition.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 315 of file Conditional.h.
|
inlineoverridevirtual |
Get the quantum bits affected by the operation.
Get the quantum bits affected by the operation. Returns an empty vector as the operation is not affecting any qubit. Implementation is required by the interface.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 552 of file Conditional.h.
|
inlinevirtualinherited |
Find if the operation can affect the quantum state.
Returns true if the operation can affect the quantum state, false otherwise.
Reimplemented in Circuits::Circuit< Time >, and Circuits::Circuit< Types::time_type >.
Definition at line 429 of file Operations.h.
References Circuits::IOperation< Time >::GetType(), Circuits::kComposite, Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kGate, Circuits::kMeasurement, and Circuits::kReset.
|
inlineoverridevirtual |
Get a shared pointer to a clone of this object.
Returns a shared pointer to a copy of this object.
Implements Circuits::IOperation< Time >.
Definition at line 535 of file Conditional.h.
References Circuits::IOperation< Time >::Clone(), and Circuits::IConditionalOperation< Time >::GetOperation().
|
inlineoverridevirtualinherited |
Execute the operation.
Execute the operation if the condition is met with the specified classical state, in the specified simulator.
| sim | The simulator to execute the operation on. |
| state | The classical state to execute the operation on (check condition against it and if it has a classical result, put the results there). |
Implements Circuits::IOperation< Time >.
Definition at line 248 of file Conditional.h.
|
inlineinherited |
Get the condition for the conditional operation.
Get the condition to check.
Definition at line 307 of file Conditional.h.
|
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 the operation for the conditional operation.
Get the operation to execute if the condition is met.
Definition at line 287 of file Conditional.h.
Referenced by Circuits::ConditionalGate< Time >::Clone(), Circuits::ConditionalMeasurement< Time >::Clone(), and Circuits::ConditionalRandomGen< Time >::Clone().
|
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.
|
inlineoverridevirtual |
Get the type of the operation.
Returns the type of the operation.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 525 of file Conditional.h.
References Circuits::kConditionalRandomGen.
|
inlineoverridevirtualinherited |
Checks if the operation is a Clifford one.
Checks if the operation is a Clifford one, allowing to be simulated in a stabilizers simulator.
Reimplemented from Circuits::IOperation< Time >.
Definition at line 365 of file Conditional.h.
|
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.
|
inlinevirtualinherited |
Find if the operation needs entanglement for distribution.
Returns true if the operation needs entanglement for distribution, false otherwise.
Reimplemented in Circuits::Circuit< Time >, and Circuits::Circuit< Types::time_type >.
Definition at line 446 of file Operations.h.
References Circuits::IOperation< Time >::AffectedQubits(), Circuits::IOperation< Time >::GetType(), Circuits::kConditionalGate, and Circuits::kGate.
|
inlineoverridevirtualinherited |
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. |
Implements Circuits::IOperation< Time >.
Definition at line 343 of file Conditional.h.
|
inlineinherited |
Set the condition for the conditional operation.
Assigns the condition to check.
| cond | The assigned condition. |
Definition at line 296 of file Conditional.h.
|
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 operation for the conditional operation.
Assigns the operation to execute if the condition is met.
| op | The assigned operation. |
Definition at line 264 of file Conditional.h.
References Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kConditionalRandomGen, Circuits::kGate, Circuits::kMeasurement, and Circuits::kRandomGen.