Skip to content
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

Custom gate filter for noise model #87

Merged
merged 4 commits into from
May 22, 2023
Merged

Custom gate filter for noise model #87

merged 4 commits into from
May 22, 2023

Conversation

lqtmirage
Copy link
Contributor

  • Allow users to specify the condition for applying noise to the gate with a user defined function when adding NoiseInstruction to NoiseModel by add_noise() method.
  • The other applicable conditions of NoiseInstruction and the custom condition are connected by AND.
  • If the noise model has no custom conditions, the cost during noise search for a gate is only single check that the dictionary is empty.

Examples

model = NoiseModel()

# If custom_gate_filter argument is omitted, it remains the same as before.
model.add_noise(BitFlipNoise(0.004, [], [names.H, names.X]))

# Works only on 2 qubit gates.
model.add_noise(
    PhaseFlipNoise(0.003, [], []),
    lambda gate: len(gate.target_indices) + len(gate.control_indices) == 2,
)

# Acting on qubit index 3 of a gate with 1 target qubit and 1 control qubit.
model.add_noise(
    DepolarizingNoise(0.002, [3], []),  # Targeting qubit index 3.   
    lambda gate: len(gate.target_indices) == 1 and len(gate.control_indices) == 1,
)

@github-actions
Copy link

🚀 Deployed on https://deploy-preview-87--quri-parts.netlify.app

@github-actions github-actions bot temporarily deployed to pull request May 15, 2023 07:01 Inactive
@kwkbtr kwkbtr merged commit b2c5c5c into main May 22, 2023
@kwkbtr kwkbtr deleted the qubit-count-noise-filter branch May 22, 2023 02:41
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2023
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.

2 participants