Skip to main content

Quantum Computer Library for Everyone

Project description

Deeq

Quantum Computing SDK

Version

Version

Tutorial

https://github.com/Deeq/Deeq-tutorials

Notice

The back end has been changed to tensor network. The previous backend environment can still be used with .run(backend="numpy").

Install

git clone https://github.com/Deeq/Deeq
cd Deeq
pip3 install -e .

or

pip3 install deeq

Circuit

from deeq import Circuit
import math

c = Circuit()

c = Circuit(50)

Method Chain

Circuit().h[0].x[0].z[0]

c = Circuit().h[0]
c.x[0].z[0]

Slice

Circuit().z[1:3] # Zgate on 1,2
Circuit().x[:3] # Xgate on (0, 1, 2)
Circuit().h[:] # Hgate on all qubits
Circuit().x[1, 2] # 1qubit gate with comma

Rotation Gate

Circuit().rz(math.pi / 4)[0]

Run

from deeq import Circuit
Circuit(50).h[:].run()

Run(shots=n)

Circuit(100).x[:].run(shots=100)
# => Counter({'1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111': 100})

Single Amplitude

Circuit(4).h[:].run(amplitude="0101")

Expectation value of hamiltonian

from deeq.pauli import Z
hamiltonian = 1*Z[0]+1*Z[1]
Circuit(4).x[:].run(hamiltonian=hamiltonian)
# => -2.0

Deeq to QASM

Circuit().h[0].to_qasm()

Hamiltonian

from deeq.pauli import *

hamiltonian1 = (1.23 * Z[0] + 4.56 * X[1] * Z[2]) ** 2
hamiltonian2 = (2.46 * Y[0] + 5.55 * Z[1] * X[2] * X[1]) ** 2
hamiltonian = hamiltonian1 + hamiltonian2
print(hamiltonian)

Simplify the Hamiltonian

hamiltonian = hamiltonian.simplify()
print(hamiltonian)

QUBO Hamiltonian

from deeq.pauli import qubo_bit as q

hamiltonian = -3*q(0)-3*q(1)-3*q(2)-3*q(3)-3*q(4)+2*q(0)*q(1)+2*q(0)*q(2)+2*q(0)*q(3)+2*q(0)*q(4)
print(hamiltonian)

Time Evolution

hamiltonian = [1.0*Z(0), 1.0*X[0]]
a = [term.get_time_evolution() for term in hamiltonian]

time_evolution = Circuit().h[0]
for evo in a:
    evo(time_evolution, np.random.rand())

print(time_evolution)

QAOA

from deeq import Circuit
from deeq.utils import qaoa
from deeq.pauli import qubo_bit as q
from deeq.pauli import X,Y,Z,I

hamiltonian = q(0)-q(1)
step = 1

result = qaoa(hamiltonian, step)
result.circuit.run(shots=100)

Circuit Drawing Backend

from deeq import vqe
from deeq.pauli import *
from deeq.pauli import qubo_bit as q

hamiltonian = Z[0]-3*Z[1]+2*Z[0]*Z[1]+3*Z[2]*Z[3]+Z[4]
step = 8

result = vqe.Vqe(vqe.QaoaAnsatz(hamiltonian, step)).run()
result.circuit.run(backend='draw')

Document

https://deeq.readthedocs.io/en/latest/

Contributors

Contributors

Disclaimer

Copyright 2022 The DeepRecommend Developers.

Deeq

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

deeq-2.0.3.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

deeq-2.0.3-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

Details for the file deeq-2.0.3.tar.gz.

File metadata

  • Download URL: deeq-2.0.3.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for deeq-2.0.3.tar.gz
Algorithm Hash digest
SHA256 7003cdc53b551ba8dcbeec264f43790637e37cc3d3fcf47982e71d09ed98725f
MD5 842230e37e113747b48cef58614de143
BLAKE2b-256 c7829cc66f5acc1b371af0236c9738cc4221744725375f04475781d821aa9d01

See more details on using hashes here.

File details

Details for the file deeq-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: deeq-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 61.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for deeq-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b164d724d462cb840bbee33d5beddcb18b83fc62f1ddcbba3c1a358023b5ada9
MD5 16d56305977b9d2fd892441c67b1e208
BLAKE2b-256 0ef30a735ea5a3c061f8f444ed5ec5511219d05800f85cc57702b0912f152f20

See more details on using hashes here.

Supported by

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