Skip to main content

A simple Python library to simulate and execute EWL quantum circuits on IBM Q.

Project description

EWL

A simple Python library to simulate and execute EWL quantum circuits on IBM Q with symbolic calculations using SymPy.

Installation

pip install ewl

Examples

Usage

from ewl import *

psi = (Qubit('00') + i * Qubit('11')) / sqrt2  # initial state

alice = U(theta=pi / 2, alpha=pi / 2, beta=0)  # quantum strategy
bob = U(theta=0, alpha=0, beta=0)  # classical strategy (C)

payoff_matrix = Array([
    [
        [3, 5],
        [0, 1],
    ],
    [
        [3, 0],
        [5, 1],
    ],
])

ewl = EWL(psi, [alice, bob], payoff_matrix)

ewl.J
ewl.J_H

ewl.amplitudes()
ewl.amplitudes(simplify=False)

ewl.probs()
ewl.probs(simplify=False)

ewl.payoff_function(player=0)
ewl.payoff_function(player=1, simplify=False)
ewl.payoff_function(player=None)

ewl.plot_payoff_function(player=0,
    x=alpha, x_min=0, x_max=pi / 2,
    y=beta, y_min=0, y_max=pi / 2)

ewl.params

ewl_fixed = ewl.fix(alpha=pi / 2, beta=0)

ewl_fixed.draw()

ewl_fixed.draw_transpiled(backend_name='ibmq_athens', optimization_level=3)

ewl_fixed.simulate_probs(backend_name='statevector_simulator')

ewl_fixed.simulate_counts(backend_name='qasm_simulator')

ewl_fixed.run(backend_name='ibmq_athens', optimization_level=3)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ewl-0.6.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ewl-0.6.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ewl-0.6.0.tar.gz.

File metadata

  • Download URL: ewl-0.6.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for ewl-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c0c96d16d25e0742e1237cfb3ecca4951c62af0c4888b3d18759a87c2c4fa403
MD5 dfd2c4669de3e5150829b6bdafc0b637
BLAKE2b-256 697d031a1da1fad236249b8b4a08a121007452a4884de84912c3db94a23cd1f9

See more details on using hashes here.

File details

Details for the file ewl-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: ewl-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for ewl-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7148e383602999d78bc8c3ef540bd0fd3951d814c5b2b527bf9bb52c0304aea
MD5 872620002b646b9fcefd42c8c9d22ddf
BLAKE2b-256 d10b474fd51b12309a5a28cb842aa6f06bb41541a7d36386f64cd3c7fb2b8ff5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page