Skip to main content

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

Metadata

Release files for deeq 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deeq 2.0.3
File Size Uploaded Provenance Actions
deeq-2.0.3.tar.gz 49.0 kB Without provenance Details for deeq-2.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deeq 2.0.3
File Interpreter ABI Platform Actions
deeq-2.0.3-py3-none-any.whl Python 3 none any Details for deeq-2.0.3-py3-none-any.whl

Total release size: 110.7 kB

Release files / deeq-2.0.3.tar.gz

Download URL deeq-2.0.3.tar.gz
Size 49.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7003cdc53b551ba8dcbeec264f43790637e37cc3d3fcf47982e71d09ed98725f
BLAKE2b-256 checksum
How to use checksums
c7829cc66f5acc1b371af0236c9738cc4221744725375f04475781d821aa9d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / deeq-2.0.3-py3-none-any.whl

Download URL deeq-2.0.3-py3-none-any.whl
Size 61.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b164d724d462cb840bbee33d5beddcb18b83fc62f1ddcbba3c1a358023b5ada9
BLAKE2b-256 checksum
How to use checksums
0ef30a735ea5a3c061f8f444ed5ec5511219d05800f85cc57702b0912f152f20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Security for deeq 2.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page