microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
samples/circuit_integration/src/Main.qs
22lines · modecode
| 1 | /// # Sample |
| 2 | /// Circuit Integration |
| 3 | /// |
| 4 | /// # Description |
| 5 | /// This sample demonstrates the ability to use circuit files in Q# projects. |
| 6 | /// It shows how to import and use custom quantum circuits defined in their own files. |
| 7 | /// The circuit file, JointMeasurement.qsc, contains a joint measurement circuit for three qubits. |
| 8 | /// This circuit file can be opened in VS Code and edited with a visual editor. |
| 9 | /// Here, we import a circuit for performing a joint measurement of three |
| 10 | /// qubits, with one auxiliary qubit. The results of the measurements should always |
| 11 | /// contain 1 or 3 `Zero` results. |
| 12 | |
| 13 | import JointMeasurement.JointMeasurement; |
| 14 | |
| 15 | /// Sample program using custom gates from a hardware provider. |
| 16 | operation Main() : Result[] { |
| 17 | use qs = Qubit[4]; |
| 18 | ApplyToEach(H, qs[0..2]); |
| 19 | let results = JointMeasurement(qs); |
| 20 | ResetAll(qs); |
| 21 | results |
| 22 | } |
| 23 | |