18#ifndef _CIRCUITCONVERTER_H_
19#define _CIRCUITCONVERTER_H_
35template <
typename Time = Types::time_type>
class Converter
51 return Convert<Circuit<Time>>(operation);
67 return Convert<IQuantumGate<Time>>(operation);
81 if (!op || op->GetNumQubits() != 1)
84 return Convert<SingleQubitGate<Time>>(operation);
98 if (!op || op->GetNumQubits() != 2)
101 return Convert<TwoQubitsGate<Time>>(operation);
115 if (!op || op->GetNumQubits() != 3)
118 return Convert<ThreeQubitsGate<Time>>(operation);
136 return Convert<Random<Time>>(operation);
152 return Convert<Reset<Time>>(operation);
168 return Convert<MeasurementOperation<Time>>(operation);
184 return Convert<ConditionalGate<Time>>(operation);
200 return Convert<ConditionalMeasurement<Time>>(operation);
216 return Convert<ConditionalRandomGen<Time>>(operation);
227 static std::shared_ptr<EqualCondition>
ToEqualCondition(
const std::shared_ptr<ICondition> &cond)
232 return std::static_pointer_cast<EqualCondition>(cond);
236 template <
typename T>
static std::shared_ptr<T> Convert(
const std::shared_ptr<
IOperation<Time>> &operation)
238 return std::static_pointer_cast<T>(operation);
static std::shared_ptr< ConditionalMeasurement< Time > > ToConditionalMeasurement(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Conditional...
static std::shared_ptr< Reset< Time > > ToReset(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Reset class...
static std::shared_ptr< ConditionalGate< Time > > ToConditionalGate(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Conditional...
static std::shared_ptr< IQuantumGate< Time > > ToQuantumGate(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the QuantumGate...
static std::shared_ptr< TwoQubitsGate< Time > > ToTwoQubitsGate(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the TwoQubitsGa...
static std::shared_ptr< Random< Time > > ToRandom(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Random clas...
static std::shared_ptr< ConditionalRandomGen< Time > > ToConditionalRandom(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Conditional...
static std::shared_ptr< ThreeQubitsGate< Time > > ToThreeQubitsGate(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the ThreeQubits...
static std::shared_ptr< EqualCondition > ToEqualCondition(const std::shared_ptr< ICondition > &cond)
Converts a smart pointer to the ICondition interface/base class to a smart pointer to the EqualCondit...
static std::shared_ptr< Circuit< Time > > ToCircuit(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Circuit cla...
static std::shared_ptr< MeasurementOperation< Time > > ToMeasurement(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the Measurement...
static std::shared_ptr< SingleQubitGate< Time > > ToSingleQubitGate(const std::shared_ptr< IOperation< Time > > &operation)
Converts a smart pointer to the IOperation interface/base class to a smart pointer to the SingleQubit...
@ kConditionalGate
conditional gate, similar with gate, but conditioned on something from 'OperationState'
@ kComposite
a composite operation, contains other operations - should not be used in the beginning,...
@ kRandomGen
random classical bit generator, result in 'OperationState'
@ kConditionalRandomGen
conditional random generator, similar with random gen, but conditioned on something from 'OperationSt...
@ kConditionalMeasurement
conditional measurement, similar with measurement, but conditioned on something from 'OperationState'
@ kMeasurement
measurement, result in 'OperationState'
@ kGate
the usual quantum gate, result stays in simulator's state
@ kReset
reset, no result in 'state', just apply measurement, then apply not on all qubits that were measured ...