Code Monkey home page Code Monkey logo

Comments (8)

BramDo avatar BramDo commented on June 7, 2024 2

That was the problem! I have many python versions also with anaconda. I did a fresh install and it works fine!

My goal is to have a good projectQ interface to the ibm api.

from projectq.

thomashaener avatar thomashaener commented on June 7, 2024

Your code is almost correct. There must be only one MainEngine per execution, so change your test_eng to be

test_eng = MainEngine(backend=IBMBackend(),
                      engine_list=[AutoReplacer(rule_set),InstructionFilter(_decomp_gates), IBMCNOTMapper()])

and get rid of ibm_eng.

Also, make sure you import IBMCNOTMapper (from projectq.cengines): It maps your circuit onto the IBM chip. I already included it in the engine_list above.

Finally, test_eng.flush() should only be called at the very end, and a simple flush is enough (don't deallocate the qubits yourself). A flush indicates that you'd like to send your quantum program over to IBM for execution (i.e., that your program is complete). Therefore, you should remove your first test_eng.flush() statement and change the last one to simply test_eng.flush().

I hope this helps!

from projectq.

BramDo avatar BramDo commented on June 7, 2024

Many thanks,

I think it works, it looks good. This is very cool. Input a matrix (X pauli ) with output a circuit in real gates. I made a hack in ibm.py. It sends the file to IBM and also writes a QASM file, this can be done in a more sophisticated way but for now, I can work with it.

from projectq.

thomashaener avatar thomashaener commented on June 7, 2024

Great, I'm glad I could help.
You could also access the qasm via test_eng.backend.qasm after flushing. But yes, at some point we could separate the qasm generation from the backend which actually sends it to the device.

from projectq.

damiansteiger avatar damiansteiger commented on June 7, 2024

FYI:

The two decomposition rules which your code uses for arbitrary (controlled) single qubit gates are now in the newest release 0.3.4 (master and develop branch).

Have fun!

from projectq.

BramDo avatar BramDo commented on June 7, 2024

I installed release 0.3.4 and the arbitrary controlled gates work fine, great!

Furthermore, I tried the compiler-tutorial but there was a recursion error: the maximum recursion depth exceeded. It has something to do with the CommandPrinter Backend in a call to _command.py.

from projectq.

thomashaener avatar thomashaener commented on June 7, 2024

Great!

I've tried python2 and 3, and both work fine. Could you try printing projectq.__version__ before running the line which fails? Maybe you installed the newest version of projectq in only one of your python versions (if you have several).

from projectq.

thomashaener avatar thomashaener commented on June 7, 2024

I'm closing this issue since it has been resolved. (But feel free to open a new one if you encounter any problems)

from projectq.

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.