QPanda (Quantum Programming Architecture for NISQ Device Applications) is a library for quantum computing which can be applied for realizing various quantum algorithms. QPanda is mainly written in C++, and can be extended to Python.
Documentation is hosted at https://qpanda-2.readthedocs.io/zh_CN/latest/
#include "QPanda.h"
#include <stdio.h>
using namespace QPanda;
init(QuantumMachine_type::CPU);
QProg prog;
auto q = qAllocMany(2);
auto c = cAllocMany(2);
prog << H(q[0])
<< CNOT(q[0],q[1])
<< MeasureAll(q, c);
auto results = runWithConfiguration(prog, c, 1000);
for (auto result : results){
printf("%s : %d\n", result.first.c_str(), result.second);
}
finalize()
from pyqpanda import *
init(QuantumMachine_type.CPU)
prog = QProg()
q = qAlloc_many(2)
c = cAlloc_many(2)
prog.insert(H(q[0]))
prog.insert(CNOT(q[0],q[1]))
prog.insert(measure_all(q,c))
result = run_with_configuration(prog, cbit_list = c, shots = 1000)
print(result)
finalize()
The design of QPanda 2 is forward-looking, considering that quantum computing will flourish and be widely applied in the future. So QPanda 2 did the following consideration when it was designed:
-
Full series compatibility.
-
Standard architecture.
-
Standardized quantum machine model.
Apache License 2.0
Copyright (c) 2017-2019 By Origin Quantum Computing. All Right Reserved.