Maestro 0.1.0
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:
Circuits::ICondition

Public Member Functions

 EqualCondition (const std::vector< size_t > &ind, const std::vector< bool > &b)
 Construct a new EqualCondition object.
bool IsConditionMet (OperationState &state) const override
 Check if the condition is met.
const std::vector< bool > & GetAllBits () const
 Get the values to compare the bits to.
void SetBits (const std::vector< bool > &b)
 Set the values to compare the bits to.
std::shared_ptr< IConditionClone () const override
 Get a shared pointer to a clone of this object.
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.
Public Member Functions inherited from Circuits::ICondition
 ICondition (const std::vector< size_t > &ind)
 Construct a new ICondition object.
virtual ~ICondition ()=default
 Virtual destructor.
const std::vector< size_t > & GetBitsIndices () const
 Get the indices of the bits used in the condition.
void SetBitsIndices (const std::vector< size_t > &ind)
 Set the indices of the bits used in the condition.
std::shared_ptr< IConditiongetptr ()
 Get a shared pointer to this object.

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 126 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 136 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 172 of file Conditional.h.

◆ 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 156 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 146 of file Conditional.h.

◆ 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 164 of file Conditional.h.


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