1
$\begingroup$

I am trying to go through the Q# tutorial at https://learn.microsoft.com/en-us/training/modules/qsharp-create-first-quantum-development-kit/4-random-number-generator before I get my hands dirty and start writing my own code. But I cannot get off the ground because I am receiving this error: The callable ResultArrayAsInt requires runtime capabilities which are not supported by the target QuantinuumProcessor. I have tried changing the <ExecutionTarget> in my .csproj file to different combinations I found in https://learn.microsoft.com/en-us/azure/quantum/provider-quantinuum ... but to no avail. Any help would be appreciated. How do I change my target Quantinuum Processor to one which has the capability to call ResultArrayAsInt?

$\endgroup$

1 Answer 1

1
$\begingroup$

You cannot use ResultArrayAsInt function in any code that runs on cloud targets in Azure Quantum. This MS Learn code sample is designed to be executed only on local simulators.

The function calls another one, BoolArrayAsInt, and ultimately updates a variable based on the values of measurement results. All Azure Quantum targets have either "No Control Flow" profile that requires that the programs return measurement results immediately or "Basic Measurement Feedback" profile that allows to apply gates based on measurement results but not update variables based on them.

To adapt this code to run on Quantinuum, you need to return an array of measurement results directly and write classical host code (for example, in Python) to convert them to an integer in the post-processing stage.

$\endgroup$
1
  • $\begingroup$ Handing the code to Python after the measurements worked perfectly for me. I did not understand the Azure Quantum target profiles. Your explanation was very helpful. Thank you. $\endgroup$ Dec 4, 2022 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.