[unitaryHACK] (#2) Qsharp support#17
Conversation
pedrorrivero
left a comment
There was a problem hiding this comment.
Thanks for the PR @Avhijit-codeboy! These are some general comments that need to be addressed before merging.
| return compile( | ||
| qsharp_code.format( | ||
| num_qubits=self.circuit.num_qubits, gates=self.circuit.gates | ||
| ) | ||
| ) |
There was a problem hiding this comment.
I thought qsharp's compile method return Union[QSharpCallable, List[QSharpCallable]]. That does not match the return type of this function. How so?
There was a problem hiding this comment.
The qsharp code defined as a Python string in the function has only one operation, operation Program():String[], which compiles and returns only one callable, Program() and hence the return type is just QSharpCallable.
There was a problem hiding this comment.
Yes, in this case all you are getting back is one QSharpCallable, but still the complete signature of the function is not that. Since you are not converting types (i.e. checking if you receive a list and "converting" it to a single callable) mypy should be sending some error: isn't it?
There was a problem hiding this comment.
mypy didn't show any error, that's why I was able to commit in the first place.
There was a problem hiding this comment.
I am wondering how is that the case though, any explanation?
There was a problem hiding this comment.
@Avhijit-codeboy sent me the source code for compile through discord: https://github.com/microsoft/iqsharp/blob/main/src/Python/qsharp-core/qsharp/__init__.py
crazy4pi314
left a comment
There was a problem hiding this comment.
Some minor things, excited to try out!
| @property | ||
| def max_measurements(self) -> int: | ||
| raise NotImplementedError(self.ERROR_MSG) | ||
| return 1048576 |
There was a problem hiding this comment.
Was this from a particular partner backend?
There was a problem hiding this comment.
No, but it confirms to Qiskit's simulator.
There was a problem hiding this comment.
This is roughly the maximum that qiskit allows (2^19 < 2^13*75 < 2^20). It was added for consistency and more as a default value. I will need to think about how to refactor, but I will take care of it myself. Any further thoughts @crazy4pi314?
|
Alright @Avhijit-codeboy great work! I will take it from here 😉 |
These are changes I implemented for Qsharp platform. Please check it and then I'll make the commits to master.