Comments (5)
This is a great point. It also comes up in the defaults which currently does do type checking. I also agree that Option 2 would be best.
One approach could be to branch off of the string name of the class e.g.
qc = qiskit.QuantumCircuit(...)
if type(qc).__name__ == 'QuantumCircuit':
# convert to cirq
Likely it would be best to wrap this in a is_qiskit(qc) -> bool
function that we can use modularly and change if there need to be a different method. For example if some other library decides to call their base program object "QuantumCircuit".
Do you think this will work @rmlarose ?
from mitiq.
A related issue, though not necessarily an urgent one, is how to do type signatures when we don't want to explicitly import the libraries. Also in the docs the Union stuff looks pretty ugly.
I'll open a discussion issue on this at #84
from mitiq.
Not sure if it is useful but with:
qc.__module__
you can get the parent module if necessary: `'qiskit.circuit.quantumcircuit' .
from mitiq.
Excellent suggestion @andreamari That's definitely the way to go.
from mitiq.
Thanks a bunch @willzeng and @andreamari for the suggestions. I will try to get Option 2 working with these ideas.
from mitiq.
Related Issues (20)
- Add Python 3.12 support
- Numpy 2.0 will have breaking changes HOT 3
- Warning raised during docs build HOT 3
- Add a linter for `docs/` HOT 5
- Add information about converting to and from non-Mitiq supported circuits HOT 2
- Make LRE compatible with non-cirq circuits
- Broken Qiskit logo in the readme HOT 1
- Include Discussions on README.md
- API-doc has run-on sentences HOT 2
- Flaky test in `rem/tests/test_inverse_confusion_matrix.py` HOT 7
- Complete «Apply PT» section in Pauli Twirling user guide HOT 1
- update to latest Changelog version HOT 1
- Create two-stage API for ZNE HOT 5
- Flaky test in `mitiq/zne/tests/test_zne.py` HOT 1
- Add functionality to generate confusion matrix on backend
- REM functionality dependent on typehinting
- Failure in `mitiq/zne/tests/test_inference.py::test_plot_data[PolyFactory]` HOT 1
- `add_noise_to_two_qubit_gates` functionality is limited HOT 1
- Update Pauli Twirling user guide
- Organize tutorials HOT 2
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 mitiq.