Is it possible to send array slices of qubits as parameters? Something like this:
using(q : Qubit[5]){
myOp(q[2:3]);
}
Is it possible to send array slices of qubits as parameters? Something like this:
using(q : Qubit[5]){
myOp(q[2:3]);
}
Copyright © 2021 Jogjafile Inc.
Yes, Q# supports array slicing: https://learn.microsoft.com/en-us/quantum/quantum-qr-expressions#array-expressions. You can use
Rangedata type as an index to create a subarray of elements of the array indexed by elements of the range.Your example will look like this: