dwavesystems / dwave-system

An API for easily incorporating the D-Wave system as a sampler, either directly or through Leap's cloud-based hybrid samplers
https://docs.ocean.dwavesys.com/
Apache License 2.0
90 stars 64 forks source link

add LinearAncillaComposite #530

Open pau557 opened 3 months ago

pau557 commented 3 months ago

In scenarios where the h biases are not available or sufficient in range, one can use auxiliary qubits polarized with a large flux bias and coupled to the data qubit. This method:

This PR adds a LinearAncillaComposite that implements this technique.

For the reviewers, please take into account future extensions of this method:

Please educate me on how to use the correct Sphynx syntax

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 83.33333% with 12 lines in your changes missing coverage. Please review.

Project coverage is 86.57%. Comparing base (b233941) to head (5867eba). Report is 31 commits behind head on master.

Files with missing lines Patch % Lines
dwave/system/composites/linear_ancilla.py 83.09% 12 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #530 +/- ## ========================================== - Coverage 89.65% 86.57% -3.09% ========================================== Files 24 25 +1 Lines 1760 1832 +72 ========================================== + Hits 1578 1586 +8 - Misses 182 246 +64 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

pau557 commented 1 week ago

Any more comments or ready to merge?

JoelPasvolsky commented 1 week ago

Any more comments or ready to merge?

@pau557 there are comments I think you might have missed, especially ones that use GitHub Suggested Change that have not been added. Examples: 1, 2, 3, 4, 5, etc. Can you look through the comments again?

pau557 commented 6 days ago

I had missed many comments, apologies @JoelPasvolsky. I think everything is addressed now

randomir commented 1 day ago

@pau557, I think we can merge this when docs comments are addressed.

pau557 commented 1 day ago

How do I tell CircleCI not to run this example with a mock sampler?

/home/circleci/project/dwave/system/testing.py:325: UserWarning: 'flux_biases' parameter is valid for DWaveSampler(), but not mocked in MockDWaveSampler().
  warnings.warn(f'{kw!r} parameter is valid for DWaveSampler(), '
/home/circleci/project/dwave/system/testing.py:325: UserWarning: 'fast_anneal' parameter is valid for DWaveSampler(), but not mocked in MockDWaveSampler().
  warnings.warn(f'{kw!r} parameter is valid for DWaveSampler(), '
WARNING: **********************************************************************
File "../dwave/system/composites/linear_ancilla.py", line ?, in default
Failed example:
    sampleset.first.energy
Expected:
    -3
Got:
    1.0
jackraymond commented 1 day ago

How do I tell CircleCI not to run this example with a mock sampler?

/home/circleci/project/dwave/system/testing.py:325: UserWarning: 'flux_biases' parameter is valid for DWaveSampler(), but not mocked in MockDWaveSampler().
  warnings.warn(f'{kw!r} parameter is valid for DWaveSampler(), '
/home/circleci/project/dwave/system/testing.py:325: UserWarning: 'fast_anneal' parameter is valid for DWaveSampler(), but not mocked in MockDWaveSampler().
  warnings.warn(f'{kw!r} parameter is valid for DWaveSampler(), '
WARNING: **********************************************************************
File "../dwave/system/composites/linear_ancilla.py", line ?, in default
Failed example:
    sampleset.first.energy
Expected:
    -3
Got:
    1.0

You can mock the flux_biases parameter with h if you want this to behave correctly. You can also suppress the warnings. e.g. https://github.com/AndyZzzZzzZzz/shimming-tutorial/blob/development/tutorial_code/helpers/sampler_wrapper.py I think its worth testing