amazon-braket / BraketSimulator.jl

Apache License 2.0
9 stars 3 forks source link

fix: DM noise warning #23

Closed krneta closed 1 month ago

krneta commented 1 month ago

Issue #, if available:

Description of changes:

The DM simulator would always output the warning that there was no noise in the circuit (even when there is). This seems to be because when we get the types from the circuit instructions they are all prefixed with "braket.". I've removed the prefix.

Testing done:

Tested with noisy circuit to verify the warning message is no longer output.

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.

kshyatt-aws commented 1 month ago

Sorry, will this break things for pure Julia users? Could we make the check an || (or)?

krneta commented 1 month ago

Sorry, will this break things for pure Julia users? Could we make the check an || (or)?

If it doesn't find "braket." it should just be a no-op, right?

kshyatt-aws commented 1 month ago

Yes, but you can also get rid of the repeated replace. https://docs.julialang.org/en/v1/base/strings/#Base.replace-Tuple{IO,%20AbstractString,%20Vararg{Pair}} Multiple patterns are supported in one call.

krneta commented 1 month ago

Yes, but you can also get rid of the repeated replace. https://docs.julialang.org/en/v1/base/strings/#Base.replace-Tuple{IO,%20AbstractString,%20Vararg{Pair}} Multiple patterns are supported in one call.

Oh, you're right! I was afraid I would need to use a regex.