2
$\begingroup$

In order to pass inputs to Q# operations/functions with Jupyter Notebooks, one uses the magic command, %simulate, and writes out the inputs as key-value pairs, key=value.

For example, if I had some operation, operation HelloHardy (number : Int) : Unit {...}, then I would run the following %simulate HelloHardy number=1729.

I am currently working with the operation, EvaluatePolynomial, which is part of the numerics library and takes in integers, arrays of doubles, and booleans. Below is what I am running and the error message that is generated.

%simulate EvaluatePolynomial coefficients=[1.0,1.0] evaluationPoints=[0.0,1.0] numBits=3 pointPos=3 odd=true even=false.

Received invalid parameters. Please fix and try again:

 coefficients: Error converting value "[1.0,1.0]" to type 'System.Collections.Generic.List`1[System.Double]'. Path '', line 1, position 11.

 evaluationPoints: Error converting value "[0.0,1.0]" to type 'System.Collections.Generic.List`1[System.Double]'. Path '', line 1, position 11.
$\endgroup$

1 Answer 1

1
$\begingroup$

IQ# magics don't support passing arrays as parameters at the moment. When I need to pass something more complicated than a scalar, I usually define a wrapper operation that defines all parameters and calls the original operation, and call %simulate for that wrapper operation.

$\endgroup$

Your Answer

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

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