forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetricCalculationUtils.cs
36 lines (31 loc) · 1.28 KB
/
MetricCalculationUtils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.Quantum.Simulation.Simulators.QCTraceSimulators;
namespace Microsoft.Quantum.Samples.UnitTesting
{
static class MetricCalculationUtils
{
/// <summary>
/// Returns an instance of QCTraceSimulator configured to collect
/// circuit metrics
/// </summary>
public static QCTraceSimulator GetSimulatorForMetricsCalculation()
{
// Setup QCTraceSimulator to collect all available metrics
var config = new QCTraceSimulatorConfiguration
{
useDepthCounter = true,
usePrimitiveOperationsCounter = true,
useWidthCounter = true
};
// Set up gate times to compute T depth
config.gateTimes[PrimitiveOperationsGroups.CNOT] = 0;
config.gateTimes[PrimitiveOperationsGroups.QubitClifford] = 0;
config.gateTimes[PrimitiveOperationsGroups.Measure] = 0;
config.gateTimes[PrimitiveOperationsGroups.R] = 0;
config.gateTimes[PrimitiveOperationsGroups.T] = 1;
// Create an instance of Quantum Computer Trace Simulator
return new QCTraceSimulator(config);
}
}
}