How to use known estimates with the Resource Estimator

In this article, you learn how to use pre-calculated estimates and optimize the execution of the Azure Quantum Resource Estimator.

For information about how to run the Resource Estimator, see Different ways to run the Resource Estimator.

Prerequisites

If you want to use Python in VS Code, you also need the following:

  • Install the latest version of the Python, and Jupyter extensions for VS Code.

  • The latest Azure Quantum qsharp package.

    python -m pip install --upgrade qsharp 
    

Use known estimates for an operation

If you already know some estimates for an operation, for example from a published paper, one way to reduce the execution time is taking the known estimates and incorporate them into the overall program cost.

Some scenarios where you may want to perform estimation from pre-calculated estimates:

  • You want to try a novel algorithm described in a paper to check if it improves the performance of your program. You can take estimates from the paper and incorporated them into the program.
  • You want to develop program top-down, that is, start developing from main function and then implement lower levels. You can use the known estimates at the top level with expected estimates for the entire program. As development process progresses, new components start calling to the known estimates and expected estimates are replaced by the actual implementation. In this way, estimates for the entire program are known upfront and get more precise as development progresses.

You can use the AccountForEstimates Q# operation to pass known estimates to the Resource Estimator.

Note

The special operation AccountForEstimates is an intrinsic operation for the Resource Estimator. It's not supported by other execution targets.

For example, consider the following Q# operation called FactoringFromLogicalCounts that takes a list of known estimates and a list of qubits.

import Microsoft.Quantum.ResourceEstimation.*;

operation FactoringFromLogicalCounts() : Unit {
    use qubits = Qubit[12581];

    AccountForEstimates(
        [TCount(12), RotationCount(12), RotationDepth(12),
         CczCount(3731607428), MeasurementCount(1078154040)],
        PSSPCLayout(), qubits);
}

The AccountForEstimates operation can take the following parameters:

Functions with AccountForEstimates Description
AuxQubitCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of auxiliary qubits is equal to the amount.
TCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of T gates is equal to the amount.
MeasurementCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of measurements is equal to the amount.
RotationCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of rotations is equal to the amount.
RotationDepth(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the rotation depth is equal to the amount.
CczCount(amount : Int) Returns a tuple that can be passed to the AccountForEstimates operation to specify that the number of CCZ gates is equal to the amount.
PSSPCLayout() Indicate Parallel Synthesis Sequential Pauli Computation (PSSPC) layout. For more information, see arXiv:2211.0769.

Note

If you run into any issue while working with the Resource Estimator, check out the Troubleshooting page, or contact AzureQuantumInfo@microsoft.com.