|
Maestro 0.1.0
Unified interface for quantum circuit simulation
|
#include <RandomOp.h>
Public Member Functions | |
| Random (const std::vector< size_t > &ind={}, size_t seed=0, Time delay=0) | |
| Construct a new Random object. | |
| void | Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override |
| Execute the operation. | |
| OperationType | GetType () const override |
| Get the type of the operation. | |
| const std::vector< size_t > & | GetBitsIndices () const |
| Get the indices of the classical bits affected by this operation. | |
| void | SetBitsIndices (const std::vector< size_t > &ind) |
| Set the indices of the classical bits affected by this operation. | |
| void | Seed (size_t sd) |
| Seeds the random generator. | |
| std::shared_ptr< IOperation< Time > > | Clone () const override |
| Get a shared pointer to a clone of this object. | |
| std::vector< size_t > | AffectedBits () const override |
| Get the affected bits. | |
| 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. | |
| bool | IsClifford () const override |
| Checks if the operation is a Clifford one. | |
| Public Member Functions inherited from Circuits::IOperation< Types::time_type > | |
| IOperation (Types::time_type delay=0) | |
| Construct a new IOperation object. | |
| virtual | ~IOperation ()=default |
| Destroy the IOperation object. | |
| virtual bool | CanAffectQuantumState () const |
| Find if the operation can affect the quantum state. | |
| virtual bool | NeedsEntanglementForDistribution () const |
| Find if the operation needs entanglement for distribution. | |
| virtual bool | IsConditional () const |
| Find if the operation is a conditional operation. | |
| virtual Types::qubits_vector | AffectedQubits () const |
| Returns the affected qubits. | |
| std::shared_ptr< IOperation< Types::time_type > > | getptr () |
| Get a shared pointer to this object. | |
| Types::time_type | GetDelay () const |
| Get the delay of the operation. | |
| void | SetDelay (Types::time_type d) |
| Set the delay of the operation. | |
Protected Member Functions | |
| void | SetBit (size_t index, Types::qubit_t bit) |
| Set the classical bit to index. | |
Random operation.
Implements an operation that can generate random classical bits that are stored in the classical state/register.
| Time | The data type used for operation time. |
Definition at line 33 of file RandomOp.h.
|
inline |
Construct a new Random object.
Constructs a new Random object.
| ind | The indices of the classical bits to be set by the generator. |
| seed | The seed used for the random number generator. |
| delay | The excution time. |
Definition at line 43 of file RandomOp.h.
|
inlineoverridevirtual |
Get the affected bits.
Returns the indices of the classical bits affected by this operation.
Reimplemented from Circuits::IOperation< Types::time_type >.
Definition at line 114 of file RandomOp.h.
|
inlineoverridevirtual |
Get a shared pointer to a clone of this object.
Returns a shared pointer to a copy of this object.
Implements Circuits::IOperation< Types::time_type >.
Definition at line 103 of file RandomOp.h.
|
inlineoverridevirtual |
Execute the operation.
Executes the operation.
| sim | The simulator to be used for the execution. |
| state | The state of the simulator. |
Implements Circuits::IOperation< Types::time_type >.
Definition at line 55 of file RandomOp.h.
|
inline |
Get the indices of the classical bits affected by this operation.
Returns the indices of the classical bits affected by this operation.
Definition at line 75 of file RandomOp.h.
|
inlineoverridevirtual |
Get the type of the operation.
Returns the type of the operation, in this case, random.
Reimplemented from Circuits::IOperation< Types::time_type >.
Definition at line 67 of file RandomOp.h.
|
inlineoverridevirtual |
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< Types::time_type >.
Definition at line 150 of file RandomOp.h.
|
inlineoverridevirtual |
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< Types::time_type >.
Definition at line 127 of file RandomOp.h.
|
inline |
Seeds the random generator.
Seeds the random generator using the specified seed.
| sd | The seed to be used. |
Definition at line 91 of file RandomOp.h.
|
inlineprotected |
Set the classical bit to index.
This method sets the classical bit index at the specified index.
| index | The index of the classical bit index. |
| bit | The classical bit index to set. |
Definition at line 160 of file RandomOp.h.
|
inline |
Set the indices of the classical bits affected by this operation.
Sets the indices of the classical bits affected by this operation.
| ind | The indices of the classical bits affected by this operation. |
Definition at line 83 of file RandomOp.h.