class QPanda::QScheduler¶
Overview¶
CODAR algorithm, used for mapping calculations. More…
#include <QScheduler.h> class QScheduler { public: // structs struct LogicalGate; struct PhysicsGate; // fields std::vector<int> map_list; BasicGridDevice* device; std::vector<GateInfo> mapped_result_gates; std::list<LogicalGate> logical_gate_list; std::list<LogicalGate> candidate_gates; int gate_count = 0; int swap_gate_count = 0; std::map<std::pair<int, int>, std::pair<int, double>> candidate_swaps; std::map<int, int> logical_qubit_apply_degree; std::vector<double> physics_gate_fidelity; std::vector<std::vector<double>> physics_qubit_error; double double_gate_error_rate = 0; // construction QScheduler(BasicGridDevice* device); // methods void loadCommutingTable(); size_t getLogicalQubitCount(); int addLogicalQubit(int i, int j); bool addLogicalQubits(int count, bool is_order = false); void addSingleQubitGate( std::string gate, int gate_type, int t, std::vector<double> param, int barrier_id = -1, bool is_dagger = false ); void addDoubleQubitGate( std::string gate, int gate_type, int c, int t, std::vector<double> param, bool is_dagger = false ); void start(); void setQubitFidelity( std::map<int, int> degree, std::vector<double> fidelity, std::vector<std::vector<double>> error_rate ); };
Detailed Documentation¶
CODAR algorithm, used for mapping calculations.
Fields¶
std::vector<int> map_list
the mapping table from logical qubits to physical qubits, see getMappedPosition
BasicGridDevice* device
the device
std::vector<GateInfo> mapped_result_gates
the output
std::list<LogicalGate> logical_gate_list
the list of logical gates (the whole circuit)
std::list<LogicalGate> candidate_gates
the set of Commutative Forward gates
int gate_count = 0
count of gates launched
std::map<std::pair<int, int>, std::pair<int, double>> candidate_swaps
maps from candidate swaps to their heuristic costs
Methods¶
size_t getLogicalQubitCount()
get count of logical qubits
int addLogicalQubit(int i, int j)
add a logical qubit by its position return the index of the logical qubit
bool addLogicalQubits(int count, bool is_order = false)
add several logical qubits and make initial mapping automaticly
MUST ENSURE YOU HAVEN”T MAPPED ANY QUBIT BEFORE CALLING
Parameters:
int |
count of qubits |
Returns:
bool true if success
void addSingleQubitGate( std::string gate, int gate_type, int t, std::vector<double> param, int barrier_id = -1, bool is_dagger = false )
add a (logical) single qubit gate
void addDoubleQubitGate( std::string gate, int gate_type, int c, int t, std::vector<double> param, bool is_dagger = false )
add a logical double qubit gate
void start()
start remapping (call it after intialization) , The main entry of the CODAR remapper