This sample set illustrates techniques for testing the correctness of the circuits and computing metrics describing circuits such as number of qubits used, gate counts and depth. We implement, test and compute metrics for the circuits from the following categories
- CCNOT, also know as Toffoli gates
- Controlled-SWAP, also known as Fredkin gates
- Multi-target CNOT gates
- Teleportation circuits
- Repeat Until Success Circuits
- Multiply controlled Not gates
- Super-dense coding
Each file illustrating the category is accompanied with the file ending "Tests" with test for the circuits. The list of the test files is below:
- Tests for CCNOT, also known as Toffoli gates
- Tests for Controlled-SWAP, also known as Fredkin gates
- Tests for Multi-target CNOT gates
- Tests for Teleportation circuits
- Tests for Repeat Until Success Circuits
- Tests for Multiply controlled Not gates
- Tests for Super-dense coding
The correctness of all the programs in this sample is tested using functionality from the Q# standard library:
- AssertOperationsEqualReferenced
- AssertOperationsEqualInPlace
- AssertQubitState
This sample uses Microsoft.Quantum.Xunit extension to xUnit.net framework to automatically discover Q# tests. The tests are all the operations with signature "() => ()" with suffix "Test". The test harness located in QuantumSimulatorTestTargets.cs.
In addition to testing the correctness of the circuit we also compute their metrics such as gate counts, depth and number of qubit used. Metrics calculation is illustrated in files ending "Metrics":
- Metrics for CCNOT, also known as Toffoli gates
- Metrics for Controlled-SWAP, also known as Fredkin gates
- Metrics for Repeat Until Success Circuits
- Metrics for Multiply controlled Not gates
File MetricCalculationUtils.cs contains the function that creates QCTraceSimulator configured for metric calculation.
This samples uses Microsoft.Quantum.Canon library and depends on the following NuGet packages:
- Microsoft.Quantum.Development.Kit: Q# runtime framework
- Microsoft.Quantum.Xunit: xUnit.net extension for discovering Q# tests
- xunit: xUnit.net testing framework for .NET