%simulate
Warning
This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.
The Modern QDK only supports the '%%qsharp' magic command.
Summary
Runs a given function or operation on the QuantumSimulator target machine.
Description
This magic command allows executing a given function or operation on the QuantumSimulator, which performs a full-state simulation of the given function or operation and prints the resulting return value.
See the QuantumSimulator user guide to learn more.
Required parameters
- Q# operation or function name. This must be the first parameter, and must be a valid Q# operation or function name that has been defined either in the notebook or in a Q# file in the same folder.
- Arguments for the Q# operation or function must also be specified as
key=value
pairs.
Examples for %simulate
Example 1
Simulate a Q# operation defined as operation MyOperation() : Result
:
In []: %simulate MyOperation
Out[]: <return value of the operation>
Example 2
Simulate a Q# operation defined as operation MyOperation(a : Int, b : Int) : Result
:
In []: %simulate MyOperation a=5 b=10
Out[]: <return value of the operation>
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for