Maestro 0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Circuits::ConditionalRandomGen< Time > Class Template Reference

A conditional random generator. More...

#include <Conditional.h>

Inheritance diagram for Circuits::ConditionalRandomGen< Time >:
Circuits::IConditionalOperation< Types::time_type > Circuits::IOperation< Types::time_type >

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.
OperationType GetType () const override
 Get the type of the operation.
std::shared_ptr< IOperation< Time > > Clone () const override
 Get a shared pointer to a clone of this object.
Types::qubits_vector AffectedQubits () const override
 Get the quantum bits affected by the operation.
Public Member Functions inherited from Circuits::IConditionalOperation< Types::time_type >
 IConditionalOperation (const std::shared_ptr< IOperation< Types::time_type > > &operation, const std::shared_ptr< ICondition > &condition, Types::time_type delay=0)
 Construct a new IConditionalOperation object.
void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
 Execute the operation.
void SetOperation (const std::shared_ptr< IOperation< Types::time_type > > &op)
 Set the operation for the conditional operation.
std::shared_ptr< IOperation< Types::time_type > > GetOperation () const
 Get the operation for the conditional operation.
void SetCondition (const std::shared_ptr< ICondition > &cond)
 Set the condition for the conditional operation.
std::shared_ptr< IConditionGetCondition () const
 Get the condition for the conditional operation.
std::vector< size_t > AffectedBits () const override
 Get bits that are involved in the condition.
Types::qubits_vector AffectedQubits () const override
 Get the qubits affected by the operation.
std::shared_ptr< IOperation< Types::time_type > > 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.
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.

Detailed Description

template<typename Time = Types::time_type>
class Circuits::ConditionalRandomGen< Time >

A conditional random generator.

A random generator that is executed only if a condition is met.

Template Parameters
TimeThe type of the time parameter that is used for operations timing.
See also
IConditionalOperation

Definition at line 502 of file Conditional.h.

Constructor & Destructor Documentation

◆ ConditionalRandomGen()

template<typename Time = Types::time_type>
Circuits::ConditionalRandomGen< Time >::ConditionalRandomGen ( const std::shared_ptr< Random< Time > > & operation,
const std::shared_ptr< ICondition > & condition,
Time delay = 0 )
inline

Construct a new ConditionalRandomGen object.

Construct a new ConditionalRandomGen object with the given random generator, condition and delay.

Parameters
operationThe random generator to execute if the condition is met.
conditionThe condition to check.
delayThe time required for the operation to complete.
See also
IConditionalOperation
Random
ICondition

Definition at line 516 of file Conditional.h.

Member Function Documentation

◆ AffectedQubits()

template<typename Time = Types::time_type>
Types::qubits_vector Circuits::ConditionalRandomGen< Time >::AffectedQubits ( ) const
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.

Returns
An empty vector as the operation is not affecting any qubit.

Reimplemented from Circuits::IOperation< Types::time_type >.

Definition at line 555 of file Conditional.h.

◆ Clone()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::ConditionalRandomGen< Time >::Clone ( ) const
inlineoverridevirtual

Get a shared pointer to a clone of this object.

Returns a shared pointer to a copy of this object.

Returns
A shared pointer to this object.

Implements Circuits::IOperation< Types::time_type >.

Definition at line 538 of file Conditional.h.

◆ GetType()

template<typename Time = Types::time_type>
OperationType Circuits::ConditionalRandomGen< Time >::GetType ( ) const
inlineoverridevirtual

Get the type of the operation.

Returns the type of the operation.

Returns
The type of the operation.
See also
OperationType

Reimplemented from Circuits::IOperation< Types::time_type >.

Definition at line 528 of file Conditional.h.


The documentation for this class was generated from the following file: