Maestro 0.2.5
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Circuits::EqualCondition Class Reference

Condition that checks if the bits are equal to a given value. More...

#include <Conditional.h>

+ Inheritance diagram for Circuits::EqualCondition:
+ Collaboration diagram for Circuits::EqualCondition:

Public Member Functions

 EqualCondition (const std::vector< size_t > &ind, const std::vector< bool > &b)
 Construct a new EqualCondition object.
 
std::shared_ptr< IConditionClone () const override
 Get a shared pointer to a clone of this object.
 
const std::vector< bool > & GetAllBits () const
 Get the values to compare the bits to.
 
const std::vector< size_t > & GetBitsIndices () const
 Get the indices of the bits used in the condition.
 
std::shared_ptr< IConditiongetptr ()
 Get a shared pointer to this object.
 
bool IsConditionMet (OperationState &state) const override
 Check if the condition is met.
 
std::shared_ptr< IConditionRemap (const std::unordered_map< Types::qubit_t, Types::qubit_t > &bitsMap={}) const override
 Get a shared pointer to a remapped condition.
 
void SetBits (const std::vector< bool > &b)
 Set the values to compare the bits to.
 
void SetBitsIndices (const std::vector< size_t > &ind)
 Set the indices of the bits used in the condition.
 

Detailed Description

Condition that checks if the bits are equal to a given value.

Condition that checks if the bits are equal to a given value.

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

Definition at line 127 of file Conditional.h.

Constructor & Destructor Documentation

◆ EqualCondition()

Circuits::EqualCondition::EqualCondition ( const std::vector< size_t > &  ind,
const std::vector< bool > &  b 
)
inline

Construct a new EqualCondition object.

Construct a new EqualCondition object with the given classical bits indices and classical bits values.

Parameters
indThe indices of the bits that are used in the condition.
bThe values to compare the bits to.

Definition at line 137 of file Conditional.h.

Member Function Documentation

◆ Clone()

std::shared_ptr< ICondition > Circuits::EqualCondition::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::ICondition.

Definition at line 173 of file Conditional.h.

References GetAllBits(), and Circuits::ICondition::GetBitsIndices().

◆ GetAllBits()

const std::vector< bool > & Circuits::EqualCondition::GetAllBits ( ) const
inline

Get the values to compare the bits to.

Get the values to compare the classical bits to.

Returns
The values to compare the bits to.

Definition at line 157 of file Conditional.h.

Referenced by Clone(), and IsConditionMet().

◆ GetBitsIndices()

const std::vector< size_t > & Circuits::ICondition::GetBitsIndices ( ) const
inlineinherited

Get the indices of the bits used in the condition.

Get the indices of the classical bits used in the condition.

Returns
The indices of the bits used in the condition.

Definition at line 71 of file Conditional.h.

Referenced by Clone(), and IsConditionMet().

◆ getptr()

std::shared_ptr< ICondition > Circuits::ICondition::getptr ( )
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.

Returns
A shared pointer to this object.

Definition at line 109 of file Conditional.h.

◆ IsConditionMet()

bool Circuits::EqualCondition::IsConditionMet ( OperationState state) const
inlineoverridevirtual

Check if the condition is met.

Check if the condition is met on the given classical state.

Parameters
stateThe state to check the condition against.
Returns
True if the condition is met, false otherwise.

Implements Circuits::ICondition.

Definition at line 147 of file Conditional.h.

References GetAllBits(), Circuits::OperationState::GetBits(), and Circuits::ICondition::GetBitsIndices().

◆ Remap()

std::shared_ptr< ICondition > Circuits::EqualCondition::Remap ( const std::unordered_map< Types::qubit_t, Types::qubit_t > &  bitsMap = {}) const
inlineoverridevirtual

Get a shared pointer to a remapped condition.

Returns a shared pointer to a copy of the condition with classical bits changed according to the provided map.

Parameters
bitsMapThe map of classical bits to remap.
Returns
A shared pointer to the remapped object.

Implements Circuits::ICondition.

Definition at line 186 of file Conditional.h.

◆ SetBits()

void Circuits::EqualCondition::SetBits ( const std::vector< bool > &  b)
inline

Set the values to compare the bits to.

Set the values to compare the classical bits to.

Parameters
bThe values to compare the bits to.

Definition at line 165 of file Conditional.h.

◆ SetBitsIndices()

void Circuits::ICondition::SetBitsIndices ( const std::vector< size_t > &  ind)
inlineinherited

Set the indices of the bits used in the condition.

Set the indices of the classical bits used in the condition.

Parameters
indThe indices of the bits used in the condition.

Definition at line 79 of file Conditional.h.


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