Skip to content

Python-based software for investigating coherent information and optimization-based quantum error-correcting codes.

License

Notifications You must be signed in to change notification settings

Ali-Tehrani/PyQCodes

Repository files navigation

PyQCodes

PyQCodes provides a set of functions to investigate the coherent information, minimum fidelity, certain optimization-based codes and stabilizer codes.

Guide To Do

  • Quantum Channels. See file for more info.
    • Compute Channel and Adjoint of Channel of a density matrix..
    • Compute Complementary Channel and Adjoint of Complementary Channel of a density matrix.
    • Optimize Coherent Information and Minimum Fidelity.
    • Serial/Parallel concatenate two channels .
  • Stabilizer Codes. See file for more info.
    • Find Logical Operators.
    • Apply Encoding, Measurement, and Decoding Circuit. (In Progress)
  • Optimization-Based Codes. See file for more info.
    • Effective Channel Method of Stabilizer Codes. Based on [2].
    • Approximate the average fidelity of a circuit. Based on [3].
    • Optimizes the average fidelity over Recover/Encoding operators. Based on [1]. (In Progress).

Examples

Consider the bit-flip channel acting on a density matrix :

import numpy as np
from PyQCodes.chan.channel import AnalyticQChan

p = 0.25  # Probability of error.
kraus = [(1- p) * np.eye(2), p * np.array([[0., 1.], [1., 0.]])]
dim = 2, 2  # Dimension of H_A and H_B, respectively.
qubits = [1, 1]  # Maps one qubit/particle to one qubit/particle.
channel = AnalyticQChan(kraus, qubits, dim[0], dim[1])

Bit-flip channel is a unital channel, ie . This can be seen by:

rho = np.eye(2)
new_rho = channel.channel(rho, n=1)
print(new_rho)  # Should be identity.
print("Von Neumann entropy is: ", channel.entropy(new_rho))

# Complementary channel isn't unital.
print("Complementary channel at I: ", channel.entropy_exchange(rho, n=1))

The 2-shot coherent information or minimum fidelity of can be optimized. Note that global optima is not guaranteed.

result = channel.optimize_coherent(n=2, rank=4, maxiter=100, disp=True)
# result = channel.optimize_fidelity(n=2, maxiter=100,)
print("Is successful: ", result["success"])
print("Optimal rho", result["optimal_rho"])
print("Optimal Value", result["optimal_val"])

Installing

Before, installing make sure that Python 3.6 or higher and Cython (>= 0.21) is installed. It is recommended that ProjectQ is already installed before running installation here.

First clone to a directory by running:

   git clone https://github.com/Ali-Tehrani/PyQCodes

Then going to the PyQCode directory run

   pip install -e ./ --user

Finally, it is recommended to run the tests to see if it installed correctly.

    pytest -m "not slow" -v

License

Generally, PyQCode has MIT license unless the directory/file says otherwise.

Ownership

PyQCodes is jointly owned equally by the University of Guelph (and its employees) and Huawei, funded through the Huawei Innovation Research.

Acknowledgements

Written by Ali Tehrani, Ningping Cao. supervised by Dr. Bei Zeng.

Contact Info

If any questions, feel free to open up an issue or email at "[email protected]"

References

[1]: "Channel-Adapted Quantum Error Correction for the Amplitude Damping Channel".

[2]: "Quantum error-correcting codes need not completely reveal the error syndrome."

[3]: "QVECTOR: an algorithm for device-tailored quantum error correction"

About

Python-based software for investigating coherent information and optimization-based quantum error-correcting codes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages