You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A few important algorithms (such as VQE) are structured in the following way:
Prepare quantum state using parameters
Run quantum operations and measure results
Analyze measured results and make adjustments to preparation parameters
Repeat
Note that step (3) has only classical calculations, potentially complex, that won't work in base or adaptive profile. However, algorithm doesn't need to maintain coherent quantum state between iterations of the cycle. Such computations could be done on a classical computer between "shots" of quantum computation. Base profile setup should potentially be capable of doing this if classical computations are done on a device outside quantum computer.
Currently this can be done in Python with Q# used as a subroutine but cannot be done from within Q#.
One approach to allow this is to introduce 'procedure' (in addition to 'function' and 'operation'). Procedure would only allow to use classical computations and call into procedures, functions and operations, but functions and operations won't be allowed to call into procedures. Once procedure calls into operation, a new instance of quantum computing unit is started and completes all necessary quantum computation. No quantum state needs to be saved between invocation of operations from procedures.
Alternatively, compiler may be smart enough to detect this from the code. A quantum computing unit may be initialized only when the first operation is called that allocates qubits. Once this operation exits, quantum state is no longer accessible, and quantum computing unit may be shut down. All computations between invocations of quantum computing units can be done on classical computer without limitations.
The text was updated successfully, but these errors were encountered:
A few important algorithms (such as VQE) are structured in the following way:
Note that step (3) has only classical calculations, potentially complex, that won't work in base or adaptive profile. However, algorithm doesn't need to maintain coherent quantum state between iterations of the cycle. Such computations could be done on a classical computer between "shots" of quantum computation. Base profile setup should potentially be capable of doing this if classical computations are done on a device outside quantum computer.
Currently this can be done in Python with Q# used as a subroutine but cannot be done from within Q#.
One approach to allow this is to introduce 'procedure' (in addition to 'function' and 'operation'). Procedure would only allow to use classical computations and call into procedures, functions and operations, but functions and operations won't be allowed to call into procedures. Once procedure calls into operation, a new instance of quantum computing unit is started and completes all necessary quantum computation. No quantum state needs to be saved between invocation of operations from procedures.
Alternatively, compiler may be smart enough to detect this from the code. A quantum computing unit may be initialized only when the first operation is called that allocates qubits. Once this operation exits, quantum state is no longer accessible, and quantum computing unit may be shut down. All computations between invocations of quantum computing units can be done on classical computer without limitations.
The text was updated successfully, but these errors were encountered: