microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/pythontelem

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/complex_arithmetic/polar_multiplication/Solution.qs

14lines · modecode

1namespace Kata {
2 open Microsoft.Quantum.Math;
3
4 function ComplexPolarMult(x : ComplexPolar, y : ComplexPolar) : ComplexPolar {
5 mutable theta = x.Argument + y.Argument;
6 if theta > PI() {
7 set theta -= 2.0 * PI();
8 }
9 if theta < -PI() {
10 set theta += 2.0 * PI();
11 }
12 return ComplexPolar(x.Magnitude * y.Magnitude, theta);
13 }
14}
15