tencent-quantum-lab / tensorcircuit

Tensor network based quantum software framework for the NISQ era
https://tensorcircuit.readthedocs.io
Apache License 2.0
265 stars 78 forks source link

Backend agnostic implementation of quantum Hamiltonian generation #216

Closed king-p3nguin closed 4 months ago

king-p3nguin commented 4 months ago

(I am contributing to this project as a unitaryHACK participant)

refraction-ray commented 4 months ago

thanks for the nice contribution. could you also include an example script in /examples to both check the correctness and compare the efficiency of the sparse Hamiltonian generation for different backends? (say generate Hamiltonian for several typical systems in O(20) qubits). I can also utilize the same script to benchmark the efficiency between previous impl. and the current one in case any performance degradation.

king-p3nguin commented 4 months ago

I noticed that examples/hamiltonian_building.py does the benchmark for the numpy backend, so I also added the jax and tensorflow backends in the script.

refraction-ray commented 4 months ago

LGTM, I have further added jit for these functions to improve the efficiency

refraction-ray commented 4 months ago

@all-contributors please add @king-p3nguin for example

allcontributors[bot] commented 4 months ago

@refraction-ray

I've put up a pull request to add @king-p3nguin! :tada: