Comments (7)
We were thinking about adding such a parameter to the MainEngine, similar to the -Wall gcc flag. One could then also provide different levels of verbosity, e.g., displaying full trace-backs or only partial ones (just the line number where the ancilla was allocated for example).
from projectq.
The issue with applying it to the engine is that whether or not you expect decoherence is more of a method-by-method property than a global program property. For example, if you import a library you don't want to share warning settings with them.
from projectq.
Which warning are you referring to in the context of compute/uncompute and what example do you have in mind?
-
QubitManagementError is raised if there is an error in allocating or deallocating ancilla qubits. It is necessary to make sure the compute section is unitary and we can appy the complex conjugate in the uncompute section.
-
RuntimeError("Qubit has not been measured / uncomputed. Cannot access its classical value and/or deallocate a qubit in superposition!") is raised only by the simulator back-end if qubits are just thrown away (without being in a classical state or measured). This warning is useful for debugging algorithms when you run them with the noiseless simulator. A hardware back-end with decoherence cannot throw such an error and the planned noise simulator would turn this feature off as it wouldn't make sense because all deallocated qubits (not just within compute/uncompute) which are not measured would otherwise potentially throw such an error.
from projectq.
Either one, really, but in this case I was actually talking abut QubitManagementError. Sometimes you just want to apply an operation and then its inverse, but will do something in between that breaks the ancilla uncomputation.
from projectq.
Regarding the QubitManagementError:
It only enforces the concept of compute/action/uncompute which is that compute and uncompute sections don't need to be controlled if that whole code block (compute/action/uncompute) is controlled on some other qubits (only the action parts needs to be controlled). For this to work correctly, it requires that ancilla qubits are deallocated before the end of the uncompute section (automatically done with uncompute, but needs to be manually done if using CustomUncompute). This ensures the compute section is the inverse of the uncompute section.
Let me know if you have a specific example where it doesn't work.
You can still use a noise simulator without ever running into a problem with QubitManagmentError as it only checks if you deallocate the qubit, but not if the qubit has been correctly uncomputed.
The RuntimeError from the simulator is the only one which cares about correct uncomputation in all contexts not just within uncompute and this one we turn off for a noise simulator where we have decoherence.
By the way if you just want the inverse of a previous function, you could use
my_func(qureg)
# Do sth else on qureg
with Dagger(eng):
my_func(qureg)
from projectq.
@Strilanc Did you come up with an example for a use case? Or does with Dagger(eng)
do the job?
from projectq.
I think it addresses the use case.
from projectq.
Related Issues (20)
- The code of QPE. HOT 2
- No Python, can projectq be used online? HOT 10
- About Time Evolution gate
- REST API update HOT 1
- Qasm interface HOT 5
- Install fails on macOS Big Sur
- Problems running an example notebook HOT 10
- Version 0.6.1 crashes on Linux HOT 2
- Probability distribution of qubits' classical value HOT 2
- How to check if projectq is running on C++ Simulator HOT 8
- not work on macbook with M1 Chip HOT 21
- No mapper is present in the compiler engine list! HOT 1
- IonQ uses incorrect path for backend lookup in v0.7.2 HOT 1
- Implement IonQ native gates support HOT 2
- Script runs on the simulator but encounters error on real IBM QE backend regarding a non-existent 'u2' gate HOT 8
- Python 3.9.12 on OSX HOT 6
- Minor : MacOSX 3.9 Intel work but need to use python3 HOT 1
- Issue with pip installation for version 0.8.0 HOT 3
- Reporting a vulnerability HOT 1
- Breaking changes in the AQT API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from projectq.