CQCL / pytket-cutensornet

cuTensorNet Python API extensions for pytket quantum SDK
Apache License 2.0
8 stars 1 forks source link

Interface to "high-level" API (`State`, `NetworkOperator` and `Expectation`) #84

Closed yapolyak closed 1 week ago

yapolyak commented 3 months ago

Description

Implemented interface to cutensornet "high-level API", specifically to State, NetworkOperator and Expectation. Mostly based on examples such as this one, but with some bugs fixed and some uncovered features discussed here and here with cuTN authors.

Note that automatic parallelisation (while not available in their examples yet) should be straightforward to achieve.

This shoud be wrapped in a pytket Backend class in a future PR. I also suppose that Marginal, Accessor and Sampler objects deserve to be interfaced to in the future.

Related issues

NA

Checklist

yapolyak commented 3 months ago

OK docs also seem to be failing.

yapolyak commented 3 months ago

Sorry couldn't sort out all the mypy complaints - the remaining ones are solely about pytket.

PabloAndresCQ commented 2 weeks ago

An upcoming PR will need to reintroduce the ability to use mutable tensors. To do so in ExpectationValue, the user will need to have access to an ExpectationValue object that they keep alive and update by calling the appropriate update_tensors method. The API will need to change accordingly and either provide a shallow wrapper of NVIDIA's ExpectationValue object, or inform the user to make use of NVIDIA's API explicitly.

I propose we merge this PR now and defer these changes to a later PR once NVIDIA releases their new API (excepted sometime in July), since it's likely they'll be making the user experience smoother on their side, and hence the option of not wrapping ExpectationValue being more reasonable.

yapolyak commented 1 week ago

Thank you guys! Sorry I didn't review it in time, but you seem to be handling it well!