I have the following operation in my .qs files:
operation myOp(qubits: Qubit[]) : () {
// uses elements from the qubit array
}
How do I send an array of qubits to this in the driver file? The following did not work:
Qubit[] qubits = new Qubit[2];
myOp.Run(sim, qubits);
I got the following error:
Driver.cs(13,32): error CS1503: Argument 2: cannot convert from 'Microsoft.Quantum.Simulation.Core.Qubit[]' to 'Microsoft.Quantum.Simulation.Core.QArray<Microsoft.Quantum.Simulation.Core.Qubit>' [/home/tinkidinki/Quantum/Warmup_Contest/BellState/BellState.csproj]
The build failed. Please fix the build errors and run again.
Also, as an aside: Would such a question be more suitable for this site, or for stack overflow?
myOp.Run(sim, new QArray(qubits));
$\endgroup$