%toffoli
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 ToffoliSimulator target machine.
Description
This magic command allows executing a given function or operation on the ToffoliSimulator, which performs a simulation of the given function or operation in which the state is always a simple product state in the computational basis, and prints the resulting return value.
See the ToffoliSimulator 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 %toffoli
Example 1
Use the ToffoliSimulator to simulate a Q# operation
defined as operation MyOperation() : Result
:
In []: %toffoli MyOperation
Out[]: <return value of the operation>
Example 2
Use the ToffoliSimulator to simulate a Q# operation
defined as operation MyOperation(a : Int, b : Int) : Result
:
In []: %toffoli 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