NVIDIA / cudaqx

Accelerated libraries for quantum-classical computing built on CUDA-Q.
Other
8 stars 4 forks source link

Python API Documentation & Typing #5

Open davidsbyfield opened 1 day ago

davidsbyfield commented 1 day ago

Hi Nvidia team,

Thank you for open-sourcing this library, it's very exciting and I'm keen to try some QEC experiments with GPU acceleration!

I notice that the Python API part of the documentation has not been filled in: https://nvidia.github.io/cudaqx/api/qec/python_api.html and also that the Python interface has no typing, which makes using it difficult as the IDE isn't able to help with the types of variables, or whether something is a function or a variable, and no hints for parameters are given when using functions. It would be awesome if this could be added :)

I'm trying to follow the example in the docs here: https://nvidia.github.io/cudaqx/components/qec/introduction.html#usage-example and find that I'm getting an index error: IndexError: index 0 is out of bounds for axis 0 with size 0 when running the following code:

code = qec.get_code("steane")
decoder = qec.get_decoder("single_error_lut", code.get_parity())
syndromes, data_qubit_results = qec.sample_memory_circuit(code, 10, 1)
result = decoder.decode(syndromes[0])
if result.converged:
    print("Error locations:",
          [i for i,p in enumerate(result.result) if p > 0.5])

It's possible I'm doing something silly, so do let me know if that's the case.

Thanks very much again for open-sourcing this, and I look forward to using it further.

amccaskey commented 1 day ago

Hey @davidsbyfield. Thank you for submitting this issue, we're glad to see you are using the library!

The Python API docs should definitely not be empty, this is an oversight on our part and we'll get it fixed ASAP. There was a lot of churn in getting this repository stood up and the library released. I'm sure some wires got crossed somewhere.

As for your second bug there, we will triage this and get back to you shortly!

Early days here for CUDA-Q QEC. Lots more coming in the next couple months. We appreciate you trying this out.

justinlietz commented 23 hours ago

Hi @davidsbyfield, thanks for pointing this out, we'll get this fixed ASAP. For now, there are a few complete examples in Python at https://nvidia.github.io/cudaqx/examples_rst/qec/examples.html which should give a good introduction to the APIs and how to use them.