qir-alliance / pyqir

PyQIR is a set of APIs for generating, parsing, and evaluating Quantum Intermediate Representation (QIR).
https://qir-alliance.github.io/pyqir
MIT License
54 stars 24 forks source link

Issues using ArrayType and StructType #262

Open skushnir123 opened 5 months ago

skushnir123 commented 5 months ago

I am finding it difficult to make use of ArrayType and StructType in PyQIR. It is not possible to directly instantiate these classes and it also seems impossible to subclass these types. (I get a TypeError: type 'builtins.ArrayType' is not an acceptable base type)

Additional context

The ArrayType seems to be of central importance in defining QIR programs. For example, If I want to write a QFT function (using the FunctionType) and pass in an array of qubits, this seems impossible as I cannot specify an ArrayType as a parameter to the Function.

Please let me know if I am missing something or if this is not the intended use case of PyQIR.

ausbin commented 1 month ago

Could you provide an example of what you have in mind? Like some Python code?