Git Product home page Git Product logo

Comments (5)

willzeng avatar willzeng commented on August 17, 2024

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.

willzeng avatar willzeng commented on August 17, 2024

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.

andreamari avatar andreamari commented on August 17, 2024

Not sure if it is useful but with:
qc.__module__
you can get the parent module if necessary: `'qiskit.circuit.quantumcircuit' .

from mitiq.

willzeng avatar willzeng commented on August 17, 2024

Excellent suggestion @andreamari That's definitely the way to go.

from mitiq.

rmlarose avatar rmlarose commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.