MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / QMul

Function QMul

QAlg/ArithmeticUnit/ArithmeticUnit.cpp:230–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230QCircuit QMul(QVec& a, QVec& b, QVec& k, QVec& d)
231{
232 QVec aa(a.begin(), a.end() - 1);
233 QVec bb(b.begin(), b.end() - 1);
234 QVec dd(d.begin(), d.end() - 1);
235 auto len = a.size();
236 QCircuit circ, circ1;
237 circ1 << X(d[len * 2 - 2]);
238 circ << CNOT(a[len - 1], b[len - 1]);
239 circ << circ1.control(b[len - 1]);
240 circ << CNOT(a[len - 1], b[len - 1]);
241 circ << QMultiplier(aa, bb, k, dd);
242 return circ;
243}
244
245QProg QDivider(QVec& a, QVec& b, QVec& c, QVec& k, ClassicalCondition& t)
246{

Callers 1

test_QMulFunction · 0.50

Calls 7

XClass · 0.85
CNOTClass · 0.85
QMultiplierFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
controlMethod · 0.45

Tested by 1

test_QMulFunction · 0.40