tencent-quantum-lab / tensorcircuit

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

Add circuit ``to_cirq`` and ``from_cirq`` functionality #68

Open refraction-ray opened 2 years ago

refraction-ray commented 2 years ago

Task description

Similar to AbstractCircuit.to_qiskit method, ultimately we would like to transform tensorcircuit Circuit with cirq Circuit as well.

Implementation

Add functions similar to qir2qiskit in https://github.com/tencent-quantum-lab/tensorcircuit/blob/master/tensorcircuit/translation.py. And then add a wrapper method in https://github.com/tencent-quantum-lab/tensorcircuit/blob/master/tensorcircuit/abstractcircuit.py as .to_cirq and .from_cirq. Add test similar to https://github.com/tencent-quantum-lab/tensorcircuit/blob/master/tests/test_circuit.py#L845 accordingly.

Requirements

Difficulty: ★★★

JettChenT commented 1 year ago

Hi! I'm willing to work on this issue. After a look in the code base, the to_cirq and qir2cirq functionalities are already implemented in https://github.com/tencent-quantum-lab/tensorcircuit/pull/106 .

I suppose I can work on from_cirq? Thanks!

refraction-ray commented 1 year ago

@JettChenT , thanks for your interest, feel free to contribute and open pr on this issue!

For to_cirq, the implementation now is not complete in terms of different gates, at least we need an equivalent translation of commonly used rxx, ryy, rzz gates which is lacking now. And we now have no function for from_cirq which is also welcome to contribute.

JettChenT commented 1 year ago

Got it, thanks!