Sitelet https://github.com/microsoft/qsharp-runtime/pull/1117
Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Expose joint rotations publicly, update test infrastructure - #1117

Merged
Stefan J. Wernli (swernli) merged 10 commits into
mainfrom
swernli/joint-rotations
Feb 8, 2023
Merged

Stefan J. Wernli (swernli) merged 10 commits into
mainfrom
swernli/joint-rotations

Conversation

@swernli

Copy link
Copy Markdown
Collaborator

This change adds the two qubit joint rotations to the public API surface for Q# as Rxx, Ryy, and Rzz. They are decomposed on the simulator as before in terms of Exp, and decomposed on hardware targets via single qubit rotations. The exception is the Type1 target package, which is updated to decompose all gate operations in terms of Rx, Rz, and Rzz as hardware-native intrinsics. These new Type1 decompositions are tested in a scoped test project.

In addition, the scale of existing tests is reduced to improve test performance. Instead of verifying every Q# operation up to 8 controls (which has a high simulation cost), it picks a number of controls sufficient to exercise all code paths in the decomposition. This showed local perf gains that pushed tests from taking 5 minutes end-to-end to just over 1 second end-to-end.

Resolves #1000.

Comment thread src/Simulation/TargetDefinitions/Decompositions/ApplyControlledX.qs Outdated
}
adjoint self;
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit)
A thought crawls into my mind: May be in the future, instead of using Uncontrolled and Controlled it makes sense to use <Nothing> and Controlled? E.g. instead of using
ApplyUncontrolledX and ApplyControlledX to use
ApplyX and ApplyControlledX.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point, and I've been debating doing a broader rename of the files too. My initial thinking was to use "Uncontrolled" to make explicit the fact that the operation did not support the Controlled functor, but now it just seems unnecessary and wordy. I think a broader rename could be a follow up PR.

Comment thread src/Simulation/TargetDefinitions/Tests/Type1/Tests.Type1.csproj Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving (with some doc-comment notes) to unblock. But I would recommend at least one more approval from those who understand quantum computing, e.g. César Zaragoza Cortés (@cesarzc).

@swernli
Stefan J. Wernli (swernli) marked this pull request as draft January 17, 2023 18:43
@swernli

Copy link
Copy Markdown
Collaborator Author

Converting to draft until we are ready to proceed with this change.

@kuzminrobin

Copy link
Copy Markdown
Contributor

/azp where

@azure-pipelines

Copy link
Copy Markdown
Azure DevOps orgs getting events for this repository:

@bamarsha
Brianna Marshall (bamarsha) removed their request for review January 23, 2023 21:32
@swernli
Stefan J. Wernli (swernli) marked this pull request as ready for review February 1, 2023 18:13
@swernli
Stefan J. Wernli (swernli) deleted the swernli/joint-rotations branch February 8, 2023 08:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add two-qubit rotation gates to Microsoft.Quantum.Intrinsic as fully supported APIs

2 participants