-
Notifications
You must be signed in to change notification settings - Fork 178
Windowed unitary application #602
Comments
This looks like a useful new operation, thank you for the suggestion and your PR! From the standpoint of an API review, I'd make a few different suggestions on how to make it fit better within the standard libraries. First, the Second, you may want to window over something over than individual qubits in an array. Introducing a type parameter for that would be very helpful, since the body of Taking these together, you might get something like this as an implementation: operation ApplyWindowed<'T>(windowLen : Int, op : (Int, 'T[]) => Unit, register : 'T[]) : Unit {
ApplyToEach(op, Enumerated(Windows(windowLen, register)));
} Past that, I'd also suggest introducing Thanks! |
@cgranade Thank you for the suggestions, those indeed look more idiomatic - I'll update the PR |
See comment on microsoft#602 by @cgranade
See comment on microsoft#602 by @cgranade
I'd like to combine @cgranade's suggestion to drop the target and make the array type generic, but I'd also like to include the |
I'm not sure I understand the reasoning there? That feels like it duplicates a lot of the functionality of What usecase are you looking at for including |
+1 on @cgranade on using lambda's instead of |
LGTM, I think just one last minor suggestion: |
* Add ApplyWindowed operation Applies an operation windowing over input but with const target qubits * Simplify ApplyWindowed * Update ApplyWindowed to be more idiomatic See comment on #602 by @cgranade * Fix documentation style issues for ApplyWindowed * Improve ApplyWindowed documentation and add example * Change name of ApplyWindowed to ApplyToEachWindow * Fix example being in code block Co-authored-by: Mariia Mykhailova <michaylova@gmail.com> Co-authored-by: Mathias Soeken <mathias.soeken@microsoft.com> Co-authored-by: Mariia Mykhailova <michaylova@gmail.com>
Proposal title
Windowed Unitary application
Conceptual overview
Addition of a function to apply unitary operations windowed. Windowed operations occur in many quantum algorithms and operations. This proposal proposes a wrapper that will allow windowing of operations with dedicated target qubits to make code more semantic and to provide new users easier ways to implement such operations.
Current status
Currently there is support for creating windows on Arrays, i.e., diving them into chunks of a specific size but no support for windowing operations. So to window an operation requires manually splitting an array and applying the operation over it.
User feedback
N/A
Child issues
N/A
Proposal
New and modified functions, operations, and UDTs
In namespace
Microsoft.Quantum.Arrays
:Modifications to style guide
N/A
Impact of breaking changes
N/A
Examples
Current status
Currently the most efficient solution is to inline
op
in the following:Using proposed changes
Given this function is mainly a convivence wrapper it would merely involve the single function call.
Relationship to Q# language feature proposals
N/A
Alternatives considered
An alternative would be to include an explicit transformation of the index, however this can be encapsulated in
op
Open design questions and considerations
N/A
The text was updated successfully, but these errors were encountered: