예제 #1
0
        public DepthCounter(IDoubleStatistic[] statisticsToCollect = null, bool optimizeDepth = false)
        {
            stats = new StatisticsCollector <CallGraphEdge>(
                Utils.MethodParametersNames(this, "StatisticsRecord"),
                statisticsToCollect ?? StatisticsCollector <CallGraphEdge> .DefaultStatistics()
                );
            operationCallStack = new Stack <OperationCallRecord>();

            OperationCallRecord opRec = new OperationCallRecord();

            opRec.OperationName = CallGraphEdge.CallGraphRootHashed;
            operationCallStack.Push(opRec);

            this.optimizeDepth = optimizeDepth;
            if (optimizeDepth)
            {
                qubitStartTimes = new SortedQubitPool();
                qubitEndTimes   = new SortedQubitPool();
            }
            else
            {
                qubitAvailabilityTime = new QubitAvailabilityTimeTracker(
                    initialCapacity: 128, // Reasonable number to preallocate.
                    defaultAvailabilityTime: 0.0);
            }
        }