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

Function getAngle

QAlg/ArithmeticUnit/ArithmeticUnit.cpp:604–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604double getAngle(size_t a, size_t n)
605{
606 auto bin_string = integerToBinary(a, n);
607 double angle = 0;
608 for (int i = 0; i < n; i++)
609 {
610 if (bin_string[n - 1 - i] == '1')
611 {
612 angle += pow(2, -(n - i));
613 }
614
615 angle *= PI;
616 }
617 return angle;
618}
619
620QCircuit FourierADD(QVec &result, size_t a, size_t b)
621{

Callers 1

parseQGateDataNodeMethod · 0.50

Calls 2

integerToBinaryFunction · 0.85
powFunction · 0.50

Tested by

no test coverage detected