-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Add noise operations and methods to add noise to circuits #149
Conversation
Noise classes are the building blocks of circuit for noise simulations. They can be used as operator in Instruction.
This function checks if the matrices of a Noise satisfy the condition of completely-positive trace-preserving (CPTP) maps.
This function allows user to add many Noise to a circuit at once at specified gates, qubits and times.
In circuit.moments, Instruction with Noise is keyed by NoiseMomentsKey() instead of MomentsKy. This prevents Noise from occupying additonal time stamp.
Previous check did not catch when probability = nan
When insert_strategy="inclusive", only add 1-qubit noise to a gate if gate.target is a subset of target_qubits.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
The CodeBuild CI fails because this repo has dependency on the "noise" branch of Schemas repo. I have checked that the CI will pass with the noise branch of Schemas. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
||
new_moments = Moments() | ||
time_slices = circuit.moments.time_slices() | ||
for time in range(circuit.depth): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the following (which seems off to me):
>>> from braket.circuits import Noise, Circuit
>>> noise = Noise.BitFlip(probability=0.2)
>>> circ = Circuit().x(0).cnot(0, 1).y(2)
>>> print(circ.add_noise(noise))
T : | 0 | 1 |
q0 : -X--------NBF(0.2)----------C-NBF(0.2)-
|
q1 : -NBF(0.2)-------------------X-NBF(0.2)-
q2 : -Y--------NBF(0.2)-NBF(0.2)------------
T : | 0 | 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now. The output is now:
T : | 0 | 1 |
q0 : -X--------NBF(0.2)-C--------NBF(0.2)-
|
q1 : -NBF(0.2)----------X--------NBF(0.2)-
q2 : -Y--------NBF(0.2)-NBF(0.2)----------
T : | 0 | 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test for this case (not the exact same circuit, but a similar case) was added.
Link to the discussion: amazon-braket#149 (comment)
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
… quantum annealing task (amazon-braket#235)
… quantum annealing task (amazon-braket#235)
Completed in #212 |
Description of changes:
Add operations and a result type (density matrix) that are related to noise simulation.
Add add_noise method to Circuits class.
Build directory: build_files.tar.gz
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.