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

Reset operation class. More...

#include <Reset.h>

+ Inheritance diagram for Circuits::Reset< Time >:
+ Collaboration diagram for Circuits::Reset< Time >:

Public Member Functions

 Reset (const Types::qubits_vector &qubits={}, Time delay=0, const std::vector< bool > &resetTargets={})
 Construct a new Reset object.
 
virtual std::vector< size_t > AffectedBits () const
 Returns the affected bits.
 
Types::qubits_vector AffectedQubits () const override
 Get the qubits affected by this operation.
 
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.
 
void Execute (const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
 Execute the operation.
 
Time GetDelay () const
 Get the delay of the operation.
 
std::shared_ptr< IOperation< Time > > getptr ()
 Get a shared pointer to this object.
 
const Types::qubits_vectorGetQubits () const
 Get the qubits to reset.
 
const std::vector< bool > & GetResetTargets () const
 Get the values to reset the qubits to.
 
OperationType GetType () const override
 Get the type of operation.
 
bool IsClifford () const override
 Checks if the operation is a Clifford one.
 
virtual bool IsConditional () const
 Find if the operation is a conditional 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 SetDelay (Time d)
 Set the delay of the operation.
 
void SetQubits (const Types::qubits_vector &qs, const std::vector< bool > &resetTgts={})
 Set the qubits to reset and the values to reset them to.
 

Protected Member Functions

void SetQubit (size_t index, Types::qubit_t qubit)
 Set the qubit to reset.
 

Detailed Description

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

Reset operation class.

This operation can be used to reset qubits.

Template Parameters
TimeThe time type used for operation timing.
See also
IOperation

Definition at line 33 of file Reset.h.

Constructor & Destructor Documentation

◆ Reset()

template<typename Time = Types::time_type>
Circuits::Reset< Time >::Reset ( const Types::qubits_vector qubits = {},
Time  delay = 0,
const std::vector< bool > &  resetTargets = {} 
)
inline

Construct a new Reset object.

This constructor creates a new Reset operation.

Parameters
qubitsThe qubits to reset.
delayThe execution time of the operation.
resetTargetsSpecifies what the qubits should be reset to (false |0>, true |1>, not specified |0>).

Definition at line 44 of file Reset.h.

Member Function Documentation

◆ AffectedBits()

template<typename Time = Types::time_type>
virtual std::vector< size_t > Circuits::IOperation< Time >::AffectedBits ( ) const
inlinevirtualinherited

Returns the affected bits.

Returns the affected classical bits.

Returns
The affected bits.

Reimplemented in Circuits::Circuit< Time >, Circuits::Circuit< Types::time_type >, Circuits::IConditionalOperation< Time >, Circuits::IConditionalOperation< Types::time_type >, Circuits::MeasurementOperation< Time >, and Circuits::Random< Time >.

Definition at line 478 of file Operations.h.

◆ AffectedQubits()

template<typename Time = Types::time_type>
Types::qubits_vector Circuits::Reset< Time >::AffectedQubits ( ) const
inlineoverridevirtual

Get the qubits affected by this operation.

This method returns the qubits affected by this operation, that is, the reset qubits.

Returns
The qubits affected by this operation.

Reimplemented from Circuits::IOperation< Time >.

Definition at line 132 of file Reset.h.

◆ CanAffectQuantumState()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::CanAffectQuantumState ( ) const
inlinevirtualinherited

Find if the operation can affect the quantum state.

Returns true if the operation can affect the quantum state, false otherwise.

Returns
True if the operation can affect the quantum state, false otherwise.

Reimplemented in Circuits::Circuit< Time >, and Circuits::Circuit< Types::time_type >.

Definition at line 429 of file Operations.h.

References Circuits::IOperation< Time >::GetType(), Circuits::kComposite, Circuits::kConditionalGate, Circuits::kConditionalMeasurement, Circuits::kGate, Circuits::kMeasurement, and Circuits::kReset.

◆ Clone()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::Reset< 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< Time >.

Definition at line 120 of file Reset.h.

References Circuits::IOperation< Time >::GetDelay(), Circuits::Reset< Time >::GetQubits(), and Circuits::Reset< Time >::GetResetTargets().

◆ Execute()

template<typename Time = Types::time_type>
void Circuits::Reset< Time >::Execute ( const std::shared_ptr< Simulators::ISimulator > &  sim,
OperationState state 
) const
inlineoverridevirtual

Execute the operation.

This method executes the reset operation. It's done by a measurement that is then discarded, followed by an X gate applied if needed.

Parameters
simThe simulator to execute the operation on.
stateThe current classical state.
See also
ISimulator
OperationState

Implements Circuits::IOperation< Time >.

Definition at line 58 of file Reset.h.

◆ GetDelay()

template<typename Time = Types::time_type>
Time Circuits::IOperation< Time >::GetDelay ( ) const
inlineinherited

Get the delay of the operation.

Returns the delay due of the execution time of the operation.

Returns
The delay of the operation.

Definition at line 497 of file Operations.h.

Referenced by Circuits::ConditionalGate< Time >::Clone(), Circuits::MeasurementOperation< Time >::Clone(), Circuits::NoOperation< Time >::Clone(), Circuits::PhaseGate< Time >::Clone(), Circuits::XGate< Time >::Clone(), Circuits::YGate< Time >::Clone(), Circuits::ZGate< Time >::Clone(), Circuits::HadamardGate< Time >::Clone(), Circuits::SGate< Time >::Clone(), Circuits::SdgGate< Time >::Clone(), Circuits::TGate< Time >::Clone(), Circuits::TdgGate< Time >::Clone(), Circuits::SxGate< Time >::Clone(), Circuits::SxDagGate< Time >::Clone(), Circuits::KGate< Time >::Clone(), Circuits::RxGate< Time >::Clone(), Circuits::RyGate< Time >::Clone(), Circuits::RzGate< Time >::Clone(), Circuits::UGate< Time >::Clone(), Circuits::SwapGate< Time >::Clone(), Circuits::CXGate< Time >::Clone(), Circuits::CYGate< Time >::Clone(), Circuits::CZGate< Time >::Clone(), Circuits::CPGate< Time >::Clone(), Circuits::CRxGate< Time >::Clone(), Circuits::CRyGate< Time >::Clone(), Circuits::CRzGate< Time >::Clone(), Circuits::CHGate< Time >::Clone(), Circuits::CSxGate< Time >::Clone(), Circuits::CSxDagGate< Time >::Clone(), Circuits::CUGate< Time >::Clone(), Circuits::CCXGate< Time >::Clone(), Circuits::CSwapGate< Time >::Clone(), Circuits::Random< Time >::Clone(), Circuits::Reset< Time >::Clone(), and Circuits::ComparableCircuit< Time >::operator==().

◆ getptr()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::IOperation< Time >::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 487 of file Operations.h.

◆ GetQubits()

template<typename Time = Types::time_type>
const Types::qubits_vector & Circuits::Reset< Time >::GetQubits ( ) const
inline

Get the qubits to reset.

This method returns the qubits to reset.

Returns
The qubits to reset.

Definition at line 103 of file Reset.h.

Referenced by Circuits::Reset< Time >::Clone().

◆ GetResetTargets()

template<typename Time = Types::time_type>
const std::vector< bool > & Circuits::Reset< Time >::GetResetTargets ( ) const
inline

Get the values to reset the qubits to.

This method returns the values to reset the qubits to. false means |0>, true means |1>, not specified means |0>.

Returns
The values to reset the qubits to.

Definition at line 112 of file Reset.h.

Referenced by Circuits::Reset< Time >::Clone(), and Circuits::ComparableCircuit< Time >::operator==().

◆ GetType()

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

Get the type of operation.

This method returns the type of operation.

Returns
The type of operation, reset type.
See also
OperationType

Reimplemented from Circuits::IOperation< Time >.

Definition at line 81 of file Reset.h.

References Circuits::kReset.

◆ IsClifford()

template<typename Time = Types::time_type>
bool Circuits::Reset< Time >::IsClifford ( ) const
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.

Returns
True if it can be applied in a stabilizers simulator, false otherwise.

Reimplemented from Circuits::IOperation< Time >.

Definition at line 169 of file Reset.h.

◆ IsConditional()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::IsConditional ( ) const
inlinevirtualinherited

Find if the operation is a conditional operation.

Returns true if the operation is conditional, false otherwise.

Returns
True if the operation is conditional, false otherwise.

Definition at line 458 of file Operations.h.

References Circuits::IOperation< Time >::GetType(), Circuits::kConditionalGate, Circuits::kConditionalMeasurement, and Circuits::kConditionalRandomGen.

◆ NeedsEntanglementForDistribution()

template<typename Time = Types::time_type>
virtual bool Circuits::IOperation< Time >::NeedsEntanglementForDistribution ( ) const
inlinevirtualinherited

Find if the operation needs entanglement for distribution.

Returns true if the operation needs entanglement for distribution, false otherwise.

Returns
True if the operation needs entanglement for distribution, false otherwise.

Reimplemented in Circuits::Circuit< Time >, and Circuits::Circuit< Types::time_type >.

Definition at line 446 of file Operations.h.

References Circuits::IOperation< Time >::AffectedQubits(), Circuits::IOperation< Time >::GetType(), Circuits::kConditionalGate, and Circuits::kGate.

◆ Remap()

template<typename Time = Types::time_type>
std::shared_ptr< IOperation< Time > > Circuits::Reset< 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
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.

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

Implements Circuits::IOperation< Time >.

Definition at line 144 of file Reset.h.

◆ SetDelay()

template<typename Time = Types::time_type>
void Circuits::IOperation< Time >::SetDelay ( Time  d)
inlineinherited

Set the delay of the operation.

Sets the delay due of the execution time of the operation.

Parameters
dThe delay of the operation.

Definition at line 505 of file Operations.h.

◆ SetQubit()

template<typename Time = Types::time_type>
void Circuits::Reset< Time >::SetQubit ( size_t  index,
Types::qubit_t  qubit 
)
inlineprotected

Set the qubit to reset.

This method sets the qubit to reset at the specified index.

Parameters
indexThe index of the qubit to reset.
qubitThe qubit to reset.

Definition at line 179 of file Reset.h.

◆ SetQubits()

template<typename Time = Types::time_type>
void Circuits::Reset< Time >::SetQubits ( const Types::qubits_vector qs,
const std::vector< bool > &  resetTgts = {} 
)
inline

Set the qubits to reset and the values to reset them to.

This method sets the qubits to reset and the values to reset them to.

Parameters
qsThe qubits to reset.
resetTgtsSpecifies what the qubits should be reset to (false |0>, true |1>, not specified |0>).

Definition at line 91 of file Reset.h.


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