Code Monkey home page Code Monkey logo

hongyehu / pyclifford Goto Github PK

View Code? Open in Web Editor NEW
71.0 4.0 14.0 2.51 MB

An intuitive programming package for simulating and analyzing Clifford circuits, quantum measurement, and stabilizer states with applications to many-body localization, classical shadows, quantum chemistry and error correction code.

Home Page: https://hongyehu.github.io/PyCliffordPages/intro.html

License: BSD 3-Clause "New" or "Revised" License

Python 38.42% Jupyter Notebook 61.58%
classical-shadow clifford-gates many-body-physics numba python quantum-chemistry quantum-computing stabilizer-code t-gates

pyclifford's Introduction

My name is Hong-Ye Hu. I am currently an HQI Postdoctoral Fellow at Harvard University. I am currently working on the interface between quantum computation, machine learning and many-body physics.

๐Ÿ–ฅ๏ธ: Working Experience:

  • September 2022 - Present, Harvard Quantum Initiative Fellow @ Harvard Physics, and Harvard Quantum Science & Engineering
  • May-August 2022, Quantum Algorithm Intern @ QuEra Computing Inc.
  • June-September 2021 & March-May 2022, Feynman Research Intern @ NASA quantum AI Lab, Ames Research Center, supported by NAMS Student R&D program.
  • Sept 2016-March 2018, Research Intern @ Salk Institute for biological studies. Worked on information theory and vision systems.

๐Ÿ“– Education:

  • 2018 March - 2022 February University of California, San Diego, Department of Physics. Advisor: Prof. Yi-Zhuang You.
  • 2012 September - 2016 June Peking University, Department of Physics. Advisor: Prof. Biao Wu

Alt text

๐Ÿ“‹ You can find more info at my Harvard webpage

pyclifford's People

Contributors

everettyou avatar hongyehu avatar rosetta-tan avatar taylorpatti avatar teng10 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

pyclifford's Issues

The convention for probability should be unified

The probability outcome from measurement is log_2 probability, and the bit-string probability is true probability. The convention should be fixed, and the convention will be log_2 probability for all the probability output.

[Unitary Hack]Implementation of generalized stabilizer state

The task for this bounty is to implement a class representing a "generalized stabilizer state" using the generalized stabilizer frame (GSF). In principle, GSF can represent any pure state in the Hilbert space. So this new class will support Clifford circuits and non-Clifford gates.
References, notes, and 1-on-1 meetings can be provided upon request.

Mixed state dynamics examples

Hi, I want to simulate noisy Clifford circuits. Does PyClifford have some defined api to support noisy channels, like dephasing, and depolarizing? It would be helpful if you could give some examples. Thanks.

Failed to install the package

When I try to install the PyClifford package with command pip install git+https://github.com/hongyehu/PyClifford.git, I got an error message with

ERROR: More than one .egg-info directory found in /tmp/pip-pip-egg-info-y9wxrh4l.

This error is also found when try to load the package in Colab. Can you figure out how to fix this error? Thanks.

Treat zero PauliPolynomial more systemetically

Empty PauliPolynomial should be treated as zero, but not it is not treated correctly in .add method. For this reason, the circuit.SBRG is currently patched with if len(prod) != 0: condition to avoid zero Pauli polynomial. But this matter should be treated more systematically.

Strange behavior in the measure method

Here is something that I'm seeing with the get_prob method of stabilizer states. My understanding of the method is that it takes bitstring as input where bitstring is an array of the Pauli z operators (0 is +1 and 1 is -1) that you would measure and it returns to probability of that stabilizer state returning that measurement. Assuming this is correct, here's some weird behavior:

nqubits = 3
pauli_vals = [2, 0, 1]
a = clifford_rotation_map(pauli_vals)

pauli_op = np.kron(y, np.kron(iden, x))
U_a = scipy.linalg.expm((1j*np.pi/4)*pauli_op)
state = np.zeros((2**nqubits, 1))
state[0, 0] = 1

print('Probability to sample the bitstring [0, 0, 0]')
print(a.to_state().get_prob(np.array([0, 0, 0])))
print()
print('Actual state prepared')
print(np.matmul(U_a, state))

So U_a is unitary defined by the Clifford Map a. We see that it prepares a state with amplitude 1/sqrt(2) in the state |000> . But, if I understand the method correctly, the get_prob method gives us a zero percent change of measuring +++ for a string of 3 Pauli z operators.

[unitaryHack] Intermediate representation of circuits and link to `stim` package for quantum error correction

To close this issue, one needs to design an intermediate representation of quantum circuit with pyclifford language. Users can use it to define quantum error correction code (repetition code, for example) and apply measurements and detectors (see stim for definition) for quantum error correction. Then this intermediate representation is transferred to stim's language and be able to use stim as a backend for simulation.

[Unitary Hack]Partial Trace of the stabilizer state

The task of this bounty is to implement a function p_trace(state, positions) to return a partial trace (potentially a mixed state) of the stabilizer state, and the positions are the qubits that are not being traced out. References and preliminary code can be provided upon request.
A successful solution should include testing results

[Unitary Hack]Test and benchmarking the entropy calculation for mixed state

In the current implementation, there is an attribute called the rank of the stabilizer state state.r. If state.r=0, then the state is a pure stabilizer state, and all the stabilizers are used to stabilize the state. If state.r>0, then there are state.r null stabilizers, and the state is a mixed state.
In the PyClifford, there is a function called entropy that can calculate the subsystem entropy of the state. When the state is pure, this calculation is tested. The task for this bounty is to benchmark the correctness of the entropy calculation for mixed state.
A successful solution includes 1. testing result and 2. correct entropy implementation if needed

[UnitaryHack] Mixed state unitary evolution and expectations

Implement mixed state quantum evolution, measurement, and expectation values. In the current implementation, the stabilizer state class has an attribute stabilizer_state.r which labels how many stabilizer generators are used to describe the state. For example, for a N qubit stabilizer state, in the gs matrix, the first N rows denote the stabilizer generators in binary vectors, and the second N rows denote the destabilizer generators in binary vectors. And the stabilizer generators used are from stabilizer_state.r to N, while destabilizer generators used are from stabilizer_state.r+N to 2N.

Therefore, if stabilizer_state.r=0, the state is fully stabilized by the first N generators, and the state is pure. And one need to change the evolution, measurement, calculation of expectation functions accordingly to general 0<stabilizer_state.r<=N for the mixed states.

[Unitary Hack]Mix state evolution, and expectation value calculation

Implement mixed state quantum evolution, measurement, and expectation values. In the current implementation, the stabilizer state class has an attribute stabilizer_state.r which labels how many stabilizer generators are used to describe the state. For example, for a N qubit stabilizer state, in the gs matrix, the first N rows denote the stabilizer generators in binary vectors, and the second N rows denote the destabilizer generators in binary vectors. And the stabilizer generators used are from stabilizer_state.r to N, while destabilizer generators used are from stabilizer_state.r+N to 2N.

Therefore, if stabilizer_state.r=0, the state is fully stabilized by the first N generators, and the state is pure. And one need to change the evolution, measurement, calculation of expectation functions accordingly to general 0<stabilizer_state.r<=N for the mixed states.

[UnitaryHack] Benchmarking and profiling the speed of pyclifford and torchclifford

To close this issue, one needs to profile the speed of pyclifford, and torchclifford to point out the bottleneck for the speed and potentially solutions. Currently, all the underlying mathematical functions are implemented in utils.py file, and JIT compiled with Numba.
Still, there is room for optimization. Successfully solution needs to be able to pinpoint the the bottleneck and provide potential solutions (a partial implementation and show the implementation will speed up pyclifford)

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.