GithubHelp home page GithubHelp logo

qu-tan-um / olsq Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 14.0 818 KB

OLSQ (pronounced all-s-k): Optimal Layout Synthesis for Quantum Computing

License: BSD 3-Clause "New" or "Revised" License

Jupyter Notebook 19.25% OpenQASM 56.66% Python 22.55% Shell 0.81% C++ 0.72%

olsq's People

Contributors

qu-tan-um avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

olsq's Issues

bug in latest commit

The latest commit gives the following error on the README example. The previous commit works fine.
UnboundLocalError: local variable 'map_to_block' referenced before assignment.

Example code to reproduce:

from olsq import OLSQ
from olsq.device import qcdevice

qasm_in = "OPENQASM 2.0;\n include \"qelib1.inc\";\n qreg q[3];\n h q[2];\n cx q[1], q[2];\n tdg q[2];\n " \
          "cx q[0], q[2];\n t q[2];\n cx q[1], q[2];\n tdg q[2];\n cx q[0], q[2];\n t q[1];\n t q[2];\n " \
          "cx q[0], q[1];\n h q[2];\n t q[0];\n tdg q[1];\n cx q[0], q[1];\n"

lsqc_solver = OLSQ("depth", "normal")
lsqc_solver.setprogram(qasm_in)
lsqc_solver.setdevice(qcdevice("dev", 5, [(0, 1), (1, 2), (1, 3), (3, 4)], 3))

qasm_out = lsqc_solver.solve()

Also if I change mode to "transition" in the above, I get a different error:

line 263, in solve
    lsqc.add(sigma[k][t] == False)
IndexError: list index out of range

Question about Cirq Interface

Hi,

I bumped into KEYERROR when trying out the Cirq interface. I think in the Cirq interface section in the README, setdevicegraph needs to be called before setprogram. Otherwise the mapping dictionary is empty and would trigger KEYERROR. I also have a question about the mapping. It seems like the qubits type in the input device graph and the input quantum circuit needs to be the same. Can I input a circuit in Cirq with cirq.devices.LineQubit and a coupling graph with cirq.devices.GridQubit for the solver?

Best,
Sitao

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.