17#ifndef _RESET_STATE_H_
18#define _RESET_STATE_H_
46 :
IOperation<Time>(delay), qubits(qubits), resetTargets(resetTargets)
64 sim->ApplyReset(qubits);
68 for (
size_t qi = 0; qi < resetTargets.size() && qi < qubits.size(); ++qi)
73 sim->ApplyX(qubits[qi]);
75 if (sim->SupportsMPSSwapOptimization())
77 const auto counter = sim->GetGatesCounter();
79 sim->SetGatesCounter(counter - 1);
108 resetTargets = resetTgts;
140 std::shared_ptr<IOperation<Time>>
Clone()
const override
167 std::shared_ptr<IOperation<Time>>
Remap(
const std::unordered_map<Types::qubit_t, Types::qubit_t> &qubitsMap,
168 const std::unordered_map<Types::qubit_t, Types::qubit_t> &bitsMap = {})
const override
170 auto newOp = this->
Clone();
172 for (
size_t i = 0; i < qubits.size(); ++i)
174 const auto qubitit = qubitsMap.find(qubits[i]);
175 if (qubitit != qubitsMap.end())
176 std::static_pointer_cast<Reset<Time>>(newOp)->
SetQubit(i, qubitit->second);
206 if (index < qubits.size())
207 qubits[index] = qubit;
212 std::vector<bool> resetTargets;
Time GetDelay() const
Get the delay of the operation.
IOperation(Types::time_type delay=0)
The state class that stores the classical state of a quantum circuit execution.
void SetQubits(const Types::qubits_vector &qs, const std::vector< bool > &resetTgts={})
Set the qubits to reset and the values to reset them to.
std::shared_ptr< IOperation< Time > > Clone() const override
Get a shared pointer to a clone of this object.
Reset(const Types::qubits_vector &qubits={}, Time delay=0, const std::vector< bool > &resetTargets={})
Construct a new Reset object.
void Execute(const std::shared_ptr< Simulators::ISimulator > &sim, OperationState &state) const override
Execute the operation.
void SetQubit(size_t index, Types::qubit_t qubit)
Set the qubit to reset.
OperationType GetType() const override
Get the type of operation.
const Types::qubits_vector & GetQubits() const
Get the qubits to reset.
bool IsClifford() const override
Checks if the operation is a Clifford one.
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.
const std::vector< bool > & GetResetTargets() const
Get the values to reset the qubits to.
Types::qubits_vector AffectedQubits() const override
Get the qubits affected by this operation.
OperationType
The type of operations.
@ kReset
reset, no result in 'state', just apply measurement, then apply not on all qubits that were measured ...
std::vector< qubit_t > qubits_vector
The type of a vector of qubits.
uint_fast64_t qubit_t
The type of a qubit.