mit-han-lab / torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.
https://torchquantum.org
MIT License
1.31k stars 200 forks source link

add supports for more basic operations and layers #134

Closed Hanrui-Wang closed 1 year ago

Hanrui-Wang commented 1 year ago

In order to enrich the supported operations of tq, we need your help on adding more functionalities.

Please firstly identity the gates that have not been supported by torchquantum, you can find them by having a look at other frameworks such as Qiskit, Cirq etc. You can identity the gates that not supported by looking at qiskit.circuit.library. Such as the SdG gate: SdgGate

For the simplest non-parameterized gates, you need firstly add their unitary matrix to tq.functional file: https://github.com/mit-han-lab/torchquantum/blob/8d06a998a6d35374907c5e75a347d187e837b8cc/torchquantum/functional.py#L1104 and also add their functions. Then you can add a class to the tq.operators files and finally add test function to test/test_op.py. You may create new test files.

You may also implement other template layers according to qiskit.circuit.library. https://qiskit.org/documentation/apidoc/circuit_library.html

Please let us know if you have any questions or need any instructions!

pandey-tushar commented 1 year ago

Hi, I have added the code for SDG gate in functional.py, added a class to the operators file and added the test_case as well. Should I do a PR/Merge request? I can also provide you the forked repo in case you want to check before merging.

bopardikarsoham commented 1 year ago

Hi, @Hanrui-Wang Apart from some Quantum Gates that I have added in my PR #138 , should I also add some ansatz layers/N-local circuits like RealAmplitudes, EfficientSU2, Two-Local, etc. that are used quite often in Qiskit Machine Learning

Hanrui-Wang commented 1 year ago

Hi, @Hanrui-Wang Apart from some Quantum Gates that I have added in my PR #138 , should I also add some ansatz layers/N-local circuits like RealAmplitudes, EfficientSU2, Two-Local, etc. that are used quite often in Qiskit Machine Learning

Hi bopardikarsoham,

Yes, ansatz layers/N-local layers are also very important so they are highly encouraged! When you implement RealAmplitudes, EfficientSU2, Two-Local, it would be better to also have similar hierarchy of classes as qiskit.

YuNariai commented 1 year ago

I add a PR for QFT in #142

d-bharadwaj commented 1 year ago

Made changes and Added basic gates for issue #134

Hanrui-Wang commented 1 year ago

Congrats @pandey-tushar, @bopardikarsoham and @dhanvi-bharadwaj for successfully merged the pull requests and thank you for your contributions! Since UnitaryHack comes to an end, I will close this issue but we will very appreciate if you can continue to contribute to new functionalities in torchquantum!