Git Product home page Git Product logo

cirq-qulacs's Introduction

Cirq-Qulacs

Feature

  • Fast quantum circuit simulation on Cirq with qulacs backend
  • It also supports CUDA for high performance simulation

Performance

Test enviornment

  • Depth 8 Quantum Volume circuit generated by openqasm
  • Nvidia Tesla V100
  • Intel Xeon E5-2690v4
  • Circuit compression disabled

benchmark

Installation

Requirements

Install cirq-qulacs from source

Install

git clone https://github.com/qulacs/cirq-qulacs.git
cd cirq-qulacs
python setup.py install

Uninstall

pip uninstall cirqqulacs

Sample code

CPU

import cirq
from cirqqulacs import QulacsSimulator

qubit_n = 3
qubits = [cirq.LineQubit(i) for i in range(qubit_n)]
circuit = cirq.Circuit()
circuit.append(cirq.ops.X(qubits[0]))
circuit.append(cirq.ops.rx(np.pi/5.5).on(qubits[1]))
circuit.append(cirq.ops.CCZ(qubits[0], qubits[1], qubits[2]))
result = QulacsSimulator().simulate(circuit)

GPU

import cirq
from cirqqulacs import QulacsSimulatorGpu

qubit_n = 3
qubits = [cirq.LineQubit(i) for i in range(qubit_n)]
circuit = cirq.Circuit()
circuit.append(cirq.ops.X(qubits[0]))
circuit.append(cirq.ops.rx(np.pi/5.5).on(qubits[1]))
circuit.append(cirq.ops.CCZ(qubits[0], qubits[1], qubits[2]))
result = QulacsSimulatorGpu().simulate(circuit)

License

MIT License (see LICENSE file).

cirq-qulacs's People

Contributors

corryvrequan avatar kwkbtr avatar r-imai-quantum avatar tenninyan avatar yurisan avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cirq-qulacs's Issues

Cannot Simulate any circuits with cirqqulacs

Hello,
I have run a fresh installation of cirq, qulacs, and cirqqulacs on a new anaconda environment. Whenever I try to simulate any circuit, as in the tutorial, I get the error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/as3232/.conda/envs/qulacs/lib/python3.7/site-packages/cirq/sim/simulator.py", line 435, in simulate
    program, study.ParamResolver(param_resolver), qubit_order, initial_state
  File "/home/as3232/cirq-qulacs/cirqqulacs/qulacs_simulator.py", line 128, in simulate_sweep
    final_simulator_state=final_state
  File "/home/as3232/.conda/envs/qulacs/lib/python3.7/site-packages/cirq/sim/simulator.py", line 845, in __init__
    if [final_step_result, final_simulator_state].count(None) != 1:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Here are my packages:

Package                  Version
------------------------ -----------
attrs                    20.3.0
bayesian-optimization    1.2.0
cachetools               4.2.4
certifi                  2021.5.30
charset-normalizer       2.0.7
cirq                     0.13.0
cirq-aqt                 0.13.0
cirq-core                0.13.0
cirq-google              0.13.0
cirq-ionq                0.13.0
cirq-pasqal              0.13.0
cirq-rigetti             0.13.0
cirq-web                 0.13.0
cirqqulacs               0.0.3
cma                      3.1.0
cycler                   0.10.0
decorator                5.1.0
duet                     0.2.1
google-api-core          1.31.3
google-auth              1.35.0
googleapis-common-protos 1.53.0
grpcio                   1.41.0
h11                      0.9.0
httpcore                 0.11.1
httpx                    0.15.5
idna                     2.10
importlib-metadata       3.10.1
iso8601                  0.1.16
kiwisolver               1.3.2
lark                     0.11.3
matplotlib               3.4.3
mpmath                   1.2.1
msgpack                  0.6.2
networkx                 2.6.3
nevergrad                0.4.3.post8
numpy                    1.21.2
packaging                21.0
pandas                   1.3.4
Pillow                   8.4.0
pip                      21.0.1
protobuf                 3.17.3
py                       1.10.0
Py-BOBYQA                1.3
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pydantic                 1.8.2
PyJWT                    1.7.1
pyparsing                2.4.7
pyquil                   3.0.0
python-dateutil          2.8.2
python-rapidjson         1.4
pytz                     2021.3
pyzmq                    22.3.0
qcs-api-client           0.8.0
Qulacs                   0.3.0
requests                 2.26.0
retry                    0.9.2
retrying                 1.3.3
rfc3339                  6.2
rfc3986                  1.5.0
rpcq                     3.9.2
rsa                      4.7.2
ruamel.yaml              0.17.16
ruamel.yaml.clib         0.2.6
scipy                    1.7.1
setuptools               58.0.4
six                      1.16.0
sniffio                  1.2.0
sortedcontainers         2.4.0
sympy                    1.9
toml                     0.10.2
tqdm                     4.62.3
typing-extensions        3.10.0.2
urllib3                  1.26.7
wheel                    0.37.0
zipp                     3.6.0

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.