|
Maestro 0.3.11
Unified interface for quantum circuit simulation
|
#include <RandomOp.h>
Public Member Functions | |
| Random (const std::vector< size_t > &ind, size_t seed, Time delay=0) | |
| Construct a new Random object. | |
| Random (const std::vector< size_t > &ind={}) | |
| Construct a generator with a fresh random seed. | |
| std::vector< size_t > | AffectedBits () const override |
| Get the affected bits. | |
| virtual Types::qubits_vector | AffectedQubits () const |
| Returns the affected qubits. | |
| 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. | |
| std::shared_ptr< Random< Time > > | CloneForExecution (uint64_t stream, uint64_t defaultSeed=0) const |
| Clone the generator for an independent execution stream. | |
| void | Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override |
| Execute the operation. | |
| const std::vector< size_t > & | GetBitsIndices () const |
| Get the indices of the classical bits affected by this operation. | |
| Types::time_type | GetDelay () const |
| Get the delay of the operation. | |
| std::shared_ptr< IOperation< Types::time_type > > | getptr () |
| Get a shared pointer to this object. | |
| OperationType | GetType () const override |
| Get the type of the operation. | |
| bool | HasExplicitSeed () const |
| virtual bool | IsBranching () const |
| Checks if the operation is a branching one. | |
| bool | IsClifford () const override |
| Checks if the operation is a Clifford one. | |
| virtual bool | IsConditional () const |
| Find if the operation is a conditional operation. | |
| bool | IsNoiseless () const |
| Whether noise models skip this 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 | Seed (size_t sd) |
| Seeds the random generator. | |
| void | SetBitsIndices (const std::vector< size_t > &ind) |
| Set the indices of the classical bits affected by this operation. | |
| virtual void | SetDelay (Types::time_type d) |
| Set the delay of the operation. | |
| void | SetNoiseless (bool value=true) |
| Mark the operation as exempt from injected gate noise. | |
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 34 of file RandomOp.h.
|
inline |
Construct a generator with a fresh random seed.
An execution seed, when supplied, controls this generator in network jobs.
Definition at line 42 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 55 of file RandomOp.h.
References Circuits::IOperation< Types::time_type >::IOperation(), and Seed().
|
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 159 of file RandomOp.h.
References GetBitsIndices().
|
inlinevirtualinherited |
Returns the affected qubits.
Returns the affected qubits by the operation.
Reimplemented in Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::ConditionalRandomGen< Time >, Circuits::Delay< Time >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, Circuits::QuantumChannelOperation< Time >, Circuits::Reset< Time >, Circuits::SingleQubitGate< Time >, Circuits::SingleQubitGate< Types::time_type >, Circuits::ThreeQubitsGate< Time >, Circuits::ThreeQubitsGate< Types::time_type >, Circuits::TwoQubitsGate< Time >, and Circuits::TwoQubitsGate< Types::time_type >.
Definition at line 512 of file Operations.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 >, Circuits::Circuit< Types::time_type >, Circuits::Delay< Time >, and Circuits::QuantumChannelOperation< Time >.
Definition at line 473 of file Operations.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 131 of file RandomOp.h.
References GetBitsIndices(), and Circuits::IOperation< Time >::GetDelay().
Referenced by CloneForExecution().
|
inline |
Clone the generator for an independent execution stream.
Combine an explicit instruction seed (including zero) with the stream ID. For an unseeded instruction, use defaultSeed instead: zero when the stream comes from an execution seed, or fresh entropy for an unseeded execution. Ordinary Clone() and Seed() retain their original seed semantics.
Definition at line 146 of file RandomOp.h.
References Clone(), and Simulators::IState::DeriveSeed().
Referenced by Circuits::Circuit< Time >::CloneForExecution().
|
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 67 of file RandomOp.h.
References Circuits::OperationState::SetBit().
|
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 90 of file RandomOp.h.
Referenced by AffectedBits(), and Clone().
|
inlineinherited |
Get the delay of the operation.
Returns the delay due of the execution time of the operation.
Definition at line 546 of file Operations.h.
Referenced by Circuits::NoOperation< 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 535 of file Operations.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 79 of file RandomOp.h.
References Circuits::kRandomGen.
|
inline |
Definition at line 120 of file RandomOp.h.
Referenced by Circuits::Circuit< Time >::HasUnseededRandomOperations().
|
inlinevirtualinherited |
Checks if the operation is a branching one.
Checks if the operation is a branching one, meaning that it can lead to splitting paths (relevant for the path integral simulator).
Reimplemented in Circuits::CHGate< Time >, Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::CRxGate< Time >, Circuits::CRyGate< Time >, Circuits::CSxDagGate< Time >, Circuits::CSxGate< Time >, Circuits::CUGate< Time >, Circuits::HadamardGate< Time >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::KGate< Time >, Circuits::RxGate< Time >, Circuits::RyGate< Time >, Circuits::SxDagGate< Time >, Circuits::SxGate< Time >, and Circuits::UGate< Time >.
Definition at line 607 of file Operations.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 198 of file RandomOp.h.
|
inlinevirtualinherited |
Find if the operation is a conditional operation.
Returns true if the operation is conditional, false otherwise.
Definition at line 500 of file Operations.h.
|
inlineinherited |
Whether noise models skip this operation.
Definition at line 580 of file Operations.h.
|
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 >, Circuits::Circuit< Types::time_type >, and Circuits::QuantumChannelOperation< Time >.
Definition at line 488 of file Operations.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 174 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 112 of file RandomOp.h.
Referenced by Random().
|
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 211 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 101 of file RandomOp.h.
|
inlinevirtualinherited |
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 557 of file Operations.h.
|
inlineinherited |
Mark the operation as exempt from injected gate noise.
Noise models add no noise after a noiseless operation. This is for basis changes that belong to a non-Z measurement or reset rather than being gates in their own right. Gate copies (Clone, Remap) keep the mark.
| value | True to exempt the operation from gate noise. |
Definition at line 570 of file Operations.h.