Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you learn how to use pre-calculated estimates to optimize the run time of the Microsoft Quantum resource estimator. If you already know estimates for some resource requirements for an operation, for example from a published paper, then you can pass the known estimates as input to the resource estimator and reduce the run time. The resource estimator takes the known estimates and incorporates them into the overall program cost.
For information about how to run the resource estimator, see Different ways to run the resource estimator.
Prerequisites
- The latest version of Visual Studio Code (VS Code) or open VS Code for the Web.
- The latest version of the Microsoft Quantum Development Kit (QDK) extension. For installation details, see Set up the QDK.
If you want to use Python in VS Code, then you also need to do the following:
Install the latest versions of the Python and Jupyter extensions in VS Code.
Install the latest version of the
qdkPython library.python -m pip install --upgrade qdk
Use known estimates for an operation
It's useful to pass pre-calculated estimates to the resource estimator in the following scenarios:
- You want to try an algorithm from a published paper to check whether the algorithm improves the performance of your program. You can take estimates from the paper and incorporate them into the estimation run.
- You want to develop your program top-down. You can use the known estimates at the top level and pass them to the entire program. As development progresses, you can iterate and refine the pre-calculated values.
To pass known estimates to the resource estimator in a Q# program, use the AccountForEstimates operation.
Note
The special operation AccountForEstimates is an intrinsic operation for only the resource estimator. If your Q# program contains the AccountForEstimates operation, then your program can't run on other simulator or hardware targets.
For example, the following Q# operation, called FactoringFromLogicalCounts, takes a list of known estimates and a list of qubits:
import Std.ResourceEstimation.*;
operation FactoringFromLogicalCounts() : Unit {
use qubits = Qubit[12581];
let knownEstimates = [
TCount(12),
RotationCount(12),
RotationDepth(12),
CczCount(3731607428),
MeasurementCount(1078154040)
];
AccountForEstimates(knownEstimates, PSSPCLayout(), qubits);
}
The AccountForEstimates operation can take the following parameters:
Function that you can pass to AccountForEstimates |
Description |
|---|---|
AuxQubitCount(amount : Int) |
Returns a tuple that you can pass to the AccountForEstimates operation to specify that the number of auxiliary qubits is equal to the amount. |
TCount(amount : Int) |
Returns a tuple that you can pass to the AccountForEstimates operation to specify that the number of T gates is equal to the amount. |
MeasurementCount(amount : Int) |
Returns a tuple that you can pass to the AccountForEstimates operation to specify that the number of measurements is equal to the amount. |
RotationCount(amount : Int) |
Returns a tuple that you can pass to the AccountForEstimates operation to specify that the number of rotations is equal to the amount. |
RotationDepth(amount : Int) |
Returns a tuple that you can pass to the AccountForEstimates operation to specify that the rotation depth is equal to the amount. |
CczCount(amount : Int) |
Returns a tuple that you can pass 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 experience issues when you work with the resource estimator, then see the Troubleshooting page, or contact AzureQuantumInfo@microsoft.com.