diff --git a/docs/_templates/autosummary_class.rst b/docs/_templates/autosummary_class.rst new file mode 100644 index 00000000..5f1efaf3 --- /dev/null +++ b/docs/_templates/autosummary_class.rst @@ -0,0 +1,74 @@ +{{ objname | underline}} + +.. currentmodule:: {{ module }} + +{{ 'Class' }} +{{ '-----' }} + +.. autoclass:: {{ objname }} + +{# Aesthetic section: drop if maintenance becomes a future difficulty #} +{% set counter_methods = namespace(count = 0) %} +{% for item in methods %} + {%- if not item.startswith('_') %} + {% set counter_methods.count = counter_methods.count + 1 %} + {%- endif -%} +{%- endfor %} + +{% if attributes or counter_methods.count > 0 %} + {{- 'Class Members: Summary\n' }} + {{- '----------------------'}} +{% endif %} + +{% block attributes %} +{% if attributes %} + {{- 'Properties\n' }} + {{- '~~~~~~~~~~\n' }} + {{- '.. autosummary::' }} + {% for item in attributes %} + ~{{ name }}.{{ item }} + {% endfor %} +{% endif %} +{% endblock %} + +{% block methods %} +{% if counter_methods.count > 0 %} + {{- 'Methods\n' }} + {{- '~~~~~~~\n' }} + {{- '.. autosummary::' }} + {{- ' :nosignatures:'}} + {% for item in methods %} + {%- if not item.startswith('_') %} + ~{{ name }}.{{ item }} + {%- endif -%} + {% endfor %} +{% endif %} +{% endblock %} + +{% if attributes or counter_methods.count > 0 %} + {{- 'Class Members: Descriptions\n' }} + {{- '---------------------------' }} +{% endif %} + + +{% block attributes2 %} +{% if attributes %} + {{- 'Properties\n' }} + {{- '~~~~~~~~~~\n' }} + {% for item in attributes %} +.. autoattribute:: {{ name }}.{{ item }} + {%- endfor %} +{% endif %} +{% endblock %} + +{% block methods2 %} +{% if counter_methods.count > 0 %} + {{- 'Methods\n' }} + {{- '~~~~~~~\n' }} + {% for item in methods %} + {%- if not item.startswith('_') %} +.. automethod:: {{ name }}.{{ item }} + {%- endif -%} + {% endfor %} +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/docs/_templates/autosummary_module_functions.rst b/docs/_templates/autosummary_module_functions.rst new file mode 100644 index 00000000..d17df16b --- /dev/null +++ b/docs/_templates/autosummary_module_functions.rst @@ -0,0 +1,33 @@ +{{ fullname | escape | underline}} + +.. automodule:: {{ fullname }} + +{{ 'Functions: Summary' }} +{{ '------------------' }} + +{% block functions %} +{# To prevent template error, but template should not be applied to such modules #} +{% if functions %} + {{- '.. autosummary::' }} + {%- for item in functions %} + {%- if not item.startswith('_') %} + {{ item }} + {%- endif %} + {%- endfor %} +{% endif %} +{% endblock %} + + +{{ 'Functions: Descriptions'}} +{{ '-----------------------' }} + +{% block functions2 %} +{# To prevent template error, but template should not be applied to such modules #} +{% if functions %} + {%- for item in functions %} + {%- if not item.startswith('_') %} +.. autofunction:: {{ item }} + {%- endif %} + {%- endfor %} +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/docs/composites.rst b/docs/composites.rst index 08b721ee..de10c410 100644 --- a/docs/composites.rst +++ b/docs/composites.rst @@ -14,68 +14,21 @@ Other Ocean packages provide additional composites; for example, on the problem (e.g., scaling values), track inputs and outputs for debugging, and other useful functionality relevant to generic samplers. + CutOffs ======= Prunes the binary quadratic model (BQM) submitted to the child sampler by retaining only interactions with values commensurate with the sampler’s precision. -CutOffComposite ---------------- - -.. autoclass:: CutOffComposite - - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - CutOffComposite.child - CutOffComposite.children - CutOffComposite.parameters - CutOffComposite.properties - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - CutOffComposite.sample - CutOffComposite.sample_ising - CutOffComposite.sample_qubo - -PolyCutOffComposite -------------------- - -Prunes the polynomial submitted to the child sampler by retaining -only interactions with values commensurate with the sampler’s precision. - -.. autoclass:: PolyCutOffComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - PolyCutOffComposite.child - PolyCutOffComposite.children - PolyCutOffComposite.parameters - PolyCutOffComposite.properties - -Methods -~~~~~~~ - .. autosummary:: - :toctree: generated/ - - PolyCutOffComposite.sample_poly - PolyCutOffComposite.sample_hising - PolyCutOffComposite.sample_hubo + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst + CutOffComposite + PolyCutOffComposite Embedding @@ -87,223 +40,35 @@ Embedding .. currentmodule:: dwave.system.composites -AutoEmbeddingComposite ----------------------- - -.. autoclass:: AutoEmbeddingComposite - -Properties -~~~~~~~~~~ - .. autosummary:: - :toctree: generated/ - - AutoEmbeddingComposite.child - AutoEmbeddingComposite.parameters - AutoEmbeddingComposite.properties - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - AutoEmbeddingComposite.sample - AutoEmbeddingComposite.sample_ising - AutoEmbeddingComposite.sample_qubo - - -EmbeddingComposite ------------------- - -.. autoclass:: EmbeddingComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - EmbeddingComposite.child - EmbeddingComposite.parameters - EmbeddingComposite.properties - EmbeddingComposite.return_embedding_default - EmbeddingComposite.warnings_default - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - EmbeddingComposite.sample - EmbeddingComposite.sample_ising - EmbeddingComposite.sample_qubo - - -FixedEmbeddingComposite ------------------------ - -.. autoclass:: FixedEmbeddingComposite - :show-inheritance: - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - FixedEmbeddingComposite.adjacency - FixedEmbeddingComposite.child - FixedEmbeddingComposite.children - FixedEmbeddingComposite.edgelist - FixedEmbeddingComposite.nodelist - FixedEmbeddingComposite.parameters - FixedEmbeddingComposite.properties - FixedEmbeddingComposite.structure - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - FixedEmbeddingComposite.sample - FixedEmbeddingComposite.sample_ising - FixedEmbeddingComposite.sample_qubo - - -LazyFixedEmbeddingComposite ---------------------------- - -.. autoclass:: LazyFixedEmbeddingComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - - LazyFixedEmbeddingComposite.adjacency - LazyFixedEmbeddingComposite.edgelist - LazyFixedEmbeddingComposite.nodelist - LazyFixedEmbeddingComposite.parameters - LazyFixedEmbeddingComposite.properties - LazyFixedEmbeddingComposite.structure - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - LazyFixedEmbeddingComposite.sample - LazyFixedEmbeddingComposite.sample_ising - LazyFixedEmbeddingComposite.sample_qubo - - -ParallelEmbeddingComposite --------------------------- - -.. autoclass:: ParallelEmbeddingComposite - - -TilingComposite ---------------- - -.. autoclass:: TilingComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - TilingComposite.adjacency - TilingComposite.child - TilingComposite.children - TilingComposite.edgelist - TilingComposite.embeddings - TilingComposite.nodelist - TilingComposite.num_tiles - TilingComposite.parameters - TilingComposite.properties - TilingComposite.structure - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - TilingComposite.sample - TilingComposite.sample_ising - TilingComposite.sample_qubo - -VirtualGraphComposite ---------------------- - -.. autoclass:: VirtualGraphComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - VirtualGraphComposite.adjacency - VirtualGraphComposite.child - VirtualGraphComposite.children - VirtualGraphComposite.edgelist - VirtualGraphComposite.nodelist - VirtualGraphComposite.parameters - VirtualGraphComposite.properties - VirtualGraphComposite.structure - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - VirtualGraphComposite.sample - VirtualGraphComposite.sample_ising - VirtualGraphComposite.sample_qubo + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst + AutoEmbeddingComposite + EmbeddingComposite + FixedEmbeddingComposite + LazyFixedEmbeddingComposite + ParallelEmbeddingComposite + TilingComposite + VirtualGraphComposite Linear Bias =========== -Composite for using auxiliary qubits to bias problem qubits. - - -LinearAncillaComposite ------------------------ - -.. autoclass:: LinearAncillaComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - LinearAncillaComposite.child - LinearAncillaComposite.children - LinearAncillaComposite.parameters - LinearAncillaComposite.properties +.. currentmodule:: dwave.system.composites -Methods -~~~~~~~ +Composite for using auxiliary qubits to bias problem qubits. .. autosummary:: - :toctree: generated/ + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst - LinearAncillaComposite.sample - LinearAncillaComposite.sample_ising - LinearAncillaComposite.sample_qubo + LinearAncillaComposite Reverse Anneal @@ -312,56 +77,11 @@ Reverse Anneal Composites that do batch operations for reverse annealing based on sets of initial states or anneal schedules. -ReverseBatchStatesComposite ---------------------------- - -.. autoclass:: ReverseBatchStatesComposite - - -Properties -~~~~~~~~~~ - .. autosummary:: - :toctree: generated/ - - ReverseBatchStatesComposite.child - ReverseBatchStatesComposite.children - ReverseBatchStatesComposite.parameters - ReverseBatchStatesComposite.properties - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - ReverseBatchStatesComposite.sample - ReverseBatchStatesComposite.sample_ising - ReverseBatchStatesComposite.sample_qubo - -ReverseAdvanceComposite ------------------------ - -.. autoclass:: ReverseAdvanceComposite - -Properties -~~~~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - ReverseAdvanceComposite.child - ReverseAdvanceComposite.children - ReverseAdvanceComposite.parameters - ReverseAdvanceComposite.properties - -Methods -~~~~~~~ - -.. autosummary:: - :toctree: generated/ - - ReverseAdvanceComposite.sample - ReverseAdvanceComposite.sample_ising - ReverseAdvanceComposite.sample_qubo + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst + ReverseBatchStatesComposite + ReverseAdvanceComposite diff --git a/docs/conf.py b/docs/conf.py index 50346e02..1c15f404 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,6 +26,7 @@ ] autosummary_generate = True +templates_path = ['_templates'] # The suffix(es) of source filenames. source_suffix = '.rst' diff --git a/docs/embedding.rst b/docs/embedding.rst index 1a48e320..b52263e9 100644 --- a/docs/embedding.rst +++ b/docs/embedding.rst @@ -65,61 +65,47 @@ Minor-embedding in :term:`Zephyr`-structured target graphs. Utilities ========= +The following **modules** provide functions for embedding and chains; for +example, functions such as :func:`~dwave.embedding.transforms.embed_bqm`, +:func:`~dwave.embedding.utils.chain_break_frequency` and +:func:`~dwave.embedding.chain_strength.uniform_torque_compensation`. .. autosummary:: + :recursive: :toctree: generated/ + :template: autosummary_module_functions.rst - embed_bqm - embed_ising - embed_qubo - unembed_sampleset + chain_breaks + chain_strength + transforms + utils -Diagnostics -=========== - -.. autosummary:: - :toctree: generated/ - - chain_break_frequency - diagnose_embedding - is_valid_embedding - verify_embedding - -Chain Strength -============== +Classes +------- -.. automodule:: dwave.embedding.chain_strength -.. currentmodule:: dwave.embedding +The following classes are provided. .. autosummary:: - :toctree: generated/ - - chain_strength.uniform_torque_compensation - chain_strength.scaled - -Chain-Break Resolution -====================== - -.. automodule:: dwave.embedding.chain_breaks -.. currentmodule:: dwave.embedding - -Generators ----------- + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst -.. autosummary:: - :toctree: generated/ + EmbeddedStructure + ~chain_breaks.MinimizeEnergy - chain_breaks.discard - chain_breaks.majority_vote - chain_breaks.weighted_random +Diagnostic Functions +-------------------- -Callable Objects ----------------- +These diagnostics functions are also provided. .. autosummary:: :toctree: generated/ - chain_breaks.MinimizeEnergy + chain_break_frequency + diagnose_embedding + is_valid_embedding + verify_embedding Exceptions ========== @@ -127,14 +113,9 @@ Exceptions .. autosummary:: :toctree: generated/ - exceptions.EmbeddingError - exceptions.MissingChainError exceptions.ChainOverlapError exceptions.DisconnectedChainError + exceptions.EmbeddingError exceptions.InvalidNodeError - exceptions.MissingEdgeError - -Classes -======= - -.. autoclass:: EmbeddedStructure + exceptions.MissingChainError + exceptions.MissingEdgeError \ No newline at end of file diff --git a/docs/samplers.rst b/docs/samplers.rst index e5ab13c7..a1bb584f 100644 --- a/docs/samplers.rst +++ b/docs/samplers.rst @@ -4,190 +4,53 @@ Samplers ======== -A :term:`sampler` accepts a problem in :term:`quadratic model` (e.g., BQM, CQM) or -:term:`nonlinear model` format and returns variable assignments. -Samplers generally try to find minimizing values but can also sample from -distributions defined by the problem. - -.. currentmodule:: dwave.system.samplers - -These samplers are non-blocking: the returned :class:`~dimod.SampleSet` is constructed -from a :class:`~concurrent.futures.Future`-like object that is resolved on the first -read of any of its properties; for example, by printing the results. Your code can -query its status with the :meth:`~dimod.SampleSet.done` method or ensure resolution -with the :meth:`~dimod.SampleSet.resolve` method. - -Other Ocean packages provide additional samplers; for example, -:ref:`dimod ` provides samplers for testing -your code. - -DWaveSampler +A :term:`sampler` accepts a problem in :term:`quadratic model` (e.g., BQM, CQM) +or :term:`nonlinear model` format and returns variable assignments. Samplers +generally try to find minimizing values but can also sample from distributions +defined by the problem. + +These samplers are non-blocking: the returned :class:`~dimod.SampleSet` is +constructed from a :class:`~concurrent.futures.Future`-like object that is +resolved on the first read of any of its properties; for example, by printing +the results. Your code can query its status with the +:meth:`~dimod.SampleSet.done` method or ensure resolution with the +:meth:`~dimod.SampleSet.resolve` method. + +The :ref:`Ocean ` SDK provides samplers for various uses. + +* Submitting problems directly to a quantum computer (the ``dwave-system`` + package); for example, the :class:`.DWaveSampler` class +* Submitting problems the the `Leap `_ + service's :term:`hybrid` solvers (the ``dwave-system`` package); for + example, the :class:`.LeapHybridNLSampler` class +* Testing your code (the :ref:`dimod ` package) +* Solving problems classically (the :ref:`dwave-samplers ` + package) + +QPU Samplers ============ -.. autoclass:: DWaveSampler - :show-inheritance: - -Properties ----------- - -For parameters and properties of D-Wave systems, see the -:ref:`qpu_index_solver_properties` and :ref:`qpu_solver_parameters` sections. - -.. autosummary:: - :toctree: generated/ - - DWaveSampler.properties - DWaveSampler.parameters - DWaveSampler.nodelist - DWaveSampler.edgelist - DWaveSampler.adjacency - DWaveSampler.structure - -Methods -------- - -.. autosummary:: - :toctree: generated/ - - DWaveSampler.sample - DWaveSampler.sample_ising - DWaveSampler.sample_qubo - DWaveSampler.validate_anneal_schedule - DWaveSampler.to_networkx_graph - DWaveSampler.close - -DWaveCliqueSampler -================== - -.. autoclass:: DWaveCliqueSampler - -Properties ----------- - -.. autosummary:: - :toctree: generated/ - - DWaveCliqueSampler.largest_clique_size - DWaveCliqueSampler.qpu_linear_range - DWaveCliqueSampler.qpu_quadratic_range - DWaveCliqueSampler.properties - DWaveCliqueSampler.parameters - DWaveCliqueSampler.target_graph - - -Methods -------- - -.. autosummary:: - :toctree: generated/ - - DWaveCliqueSampler.largest_clique - DWaveCliqueSampler.sample - DWaveCliqueSampler.sample_ising - DWaveCliqueSampler.sample_qubo - DWaveCliqueSampler.close - - -LeapHybridSampler -================= - -.. autoclass:: LeapHybridSampler - -Properties ----------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridSampler.properties - LeapHybridSampler.parameters - LeapHybridSampler.default_solver - - -Methods -------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridSampler.sample - LeapHybridSampler.sample_ising - LeapHybridSampler.sample_qubo - LeapHybridSampler.min_time_limit - LeapHybridSampler.close - -LeapHybridCQMSampler -==================== - -.. autoclass:: LeapHybridCQMSampler - -Properties ----------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridCQMSampler.properties - LeapHybridCQMSampler.parameters - - -Methods -------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridCQMSampler.sample_cqm - LeapHybridCQMSampler.min_time_limit - LeapHybridCQMSampler.close - -LeapHybridNLSampler -==================== - -.. autoclass:: LeapHybridNLSampler - -Properties ----------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridNLSampler.properties - LeapHybridNLSampler.parameters - LeapHybridNLSampler.default_solver - -Methods -------- - -.. autosummary:: - :toctree: generated/ - - LeapHybridNLSampler.sample - LeapHybridNLSampler.estimated_min_time_limit - LeapHybridNLSampler.close - -LeapHybridDQMSampler -==================== - -.. autoclass:: LeapHybridDQMSampler - -Properties ----------- +.. currentmodule:: dwave.system.samplers .. autosummary:: - :toctree: generated/ - - LeapHybridDQMSampler.properties - LeapHybridDQMSampler.parameters - LeapHybridDQMSampler.default_solver + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst + DWaveSampler + DWaveCliqueSampler -Methods -------- +Hybrid Solvers +============== .. autosummary:: - :toctree: generated/ + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst - LeapHybridDQMSampler.sample_dqm - LeapHybridDQMSampler.min_time_limit - LeapHybridDQMSampler.close + LeapHybridNLSampler + LeapHybridCQMSampler + LeapHybridSampler + LeapHybridDQMSampler \ No newline at end of file diff --git a/docs/utilities.rst b/docs/utilities.rst index d54658ea..fa8a24df 100644 --- a/docs/utilities.rst +++ b/docs/utilities.rst @@ -4,39 +4,16 @@ Utilities ========= -.. automodule:: dwave.system.utilities - .. currentmodule:: dwave.system .. autosummary:: + :recursive: :toctree: generated/ + :template: autosummary_module_functions.rst - ~utilities.anneal_schedule_with_offset - ~utilities.common_working_graph - ~coupling_groups.coupling_groups - ~utilities.energy_scales_custom_schedule - -Temperature and Unit-Conversion Utilities ------------------------------------------ - -.. automodule:: dwave.system.temperatures - -.. currentmodule:: dwave.system.temperatures - -.. autosummary:: - :toctree: generated/ - - background_susceptibility_bqm - background_susceptibility_ising - effective_field - fast_effective_temperature - fluxbias_to_h - freezeout_effective_temperature - h_to_fluxbias - Ip_in_units_of_B - maximum_pseudolikelihood - maximum_pseudolikelihood_temperature - + coupling_groups + utilities + temperatures .. [Chat2007] Chatterjee, Sourav. diff --git a/docs/warnings.rst b/docs/warnings.rst index c1eb6803..4cdd70e2 100644 --- a/docs/warnings.rst +++ b/docs/warnings.rst @@ -7,28 +7,6 @@ Warnings The ``dwave-system`` package supports various warning classes and provides the ability to configure warning handling. - -Supported Warnings -================== - -The following warnings are currently supported. - -.. currentmodule:: dwave.system.warnings - -.. autoclass:: ChainBreakWarning -.. autoclass:: ChainLengthWarning -.. autoclass:: ChainStrengthWarning -.. autoclass:: EnergyScaleWarning -.. autoclass:: TooFewSamplesWarning - -Related Information -------------------- - -* :ref:`qpu_embedding_intro` and :ref:`qpu_embedding_guidance` describe chains - and how to deal with broken chains. -* :ref:`qpu_basic_config` and :ref:`qpu_solver_configuration` provide basic - and advanced information on configuring QPU parameters and best practices. - Configuring Warnings ==================== @@ -53,17 +31,41 @@ structured to represent variable ``a`` with a long chain. >>> "warnings" in sampleset.info True -.. currentmodule:: dwave.system.warnings +Supported Warnings and Exceptions +================================= + +The following classes are currently supported. -.. autoclass:: WarningAction -.. autoclass:: WarningHandler +.. .. currentmodule:: dwave.system.warnings +.. currentmodule:: dwave.system .. autosummary:: - :toctree: generated/ - - WarningHandler.chain_break - WarningHandler.chain_length - WarningHandler.chain_strength - WarningHandler.energy_scale - WarningHandler.too_few_samples - WarningHandler.issue \ No newline at end of file + :recursive: + :nosignatures: + :toctree: generated + :template: autosummary_class.rst + + ~warnings.WarningAction + ~warnings.WarningHandler + ~warnings.ChainBreakWarning + ~warnings.ChainLengthWarning + ~warnings.ChainStrengthWarning + ~warnings.EnergyScaleWarning + ~warnings.TooFewSamplesWarning + +The following functions are supported. + +.. autosummary:: + :recursive: + :toctree: generated/ + :template: autosummary_module_functions.rst + + warnings + +Related Information +=================== + +* :ref:`qpu_embedding_intro` and :ref:`qpu_embedding_guidance` describe chains + and how to deal with broken chains. +* :ref:`qpu_basic_config` and :ref:`qpu_solver_configuration` provide basic + and advanced information on configuring QPU parameters and best practices. diff --git a/dwave/embedding/chain_breaks.py b/dwave/embedding/chain_breaks.py index dfbe01c4..ba7f14db 100644 --- a/dwave/embedding/chain_breaks.py +++ b/dwave/embedding/chain_breaks.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Unembedding samples with broken chains.""" +"""Provides functions that unembed samples with broken chains.""" from collections.abc import Callable from heapq import heapify, heappop @@ -52,8 +52,8 @@ def broken_chains(samples, chains): >>> samples = np.array([[-1, +1, -1, +1], [-1, -1, +1, +1]], dtype=np.int8) >>> chains = [[0, 1], [2, 3]] >>> dwave.embedding.broken_chains(samples, chains) - array([[True, True], - [ False, False]]) + array([[ True, True], + [False, False]]) >>> chains = [[0, 2], [1, 3]] >>> dwave.embedding.broken_chains(samples, chains) diff --git a/dwave/embedding/transforms.py b/dwave/embedding/transforms.py index 7c5d51b2..9edf6d05 100644 --- a/dwave/embedding/transforms.py +++ b/dwave/embedding/transforms.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Provides utility functions for minor embedding and unembedding.""" import collections.abc as abc import itertools @@ -231,7 +232,7 @@ def embed_bqm(self, source_bqm, chain_strength=None, smear_vartype=None): >>> embedding = {'a': {0}, 'b': {1}, 'c': {2, 3}} >>> # Embed and show the chain strength >>> target_bqm = dwave.embedding.embed_bqm(bqm, embedding, target) - >>> target_bqm.quadratic[(2, 3)] + >>> print(target_bqm.quadratic[(2, 3)]) -1.9996979771955565 >>> print(target_bqm.quadratic) # doctest: +SKIP {(0, 1): 1.0, (0, 3): 1.0, (1, 2): 1.0, (2, 3): -1.9996979771955565} diff --git a/dwave/embedding/utils.py b/dwave/embedding/utils.py index 4e21571a..d7acaaa1 100644 --- a/dwave/embedding/utils.py +++ b/dwave/embedding/utils.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Provides utility functions related to minor embedding and chains.""" import dimod import numpy as np @@ -118,7 +119,7 @@ def chain_to_quadratic(chain, target_adjacency, chain_strength): >>> chain = {1, 2} >>> target_adjacency = {0: {1, 2}, 1: {0, 2}, 2: {0, 1}} - >>> dimod.embedding.chain_to_quadratic(chain, target_adjacency, 1) + >>> dwave.embedding.chain_to_quadratic(chain, target_adjacency, 1) {(1, 2): -1} """ diff --git a/dwave/system/coupling_groups.py b/dwave/system/coupling_groups.py index 89a2c2cd..608addfd 100644 --- a/dwave/system/coupling_groups.py +++ b/dwave/system/coupling_groups.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Provides functions related to the ``per_group_coupling_range`` property.""" import dwave_networkx as dnx diff --git a/dwave/system/temperatures.py b/dwave/system/temperatures.py index 64618f7d..99fb1b77 100644 --- a/dwave/system/temperatures.py +++ b/dwave/system/temperatures.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -r"""Some notes on the parameter-estimation methods provided below: +r"""Provides temperature estimation and flux-bias offset utility functions. + +Some notes on the parameter-estimation methods provided below: - :func:`fluxbias_to_h` and :func:`h_to_fluxbias` diff --git a/dwave/system/utilities.py b/dwave/system/utilities.py index f4bb8e4d..ca3cdb2a 100644 --- a/dwave/system/utilities.py +++ b/dwave/system/utilities.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Utility functions.""" +"""Provides general utility functions.""" import os import json diff --git a/dwave/system/warnings.py b/dwave/system/warnings.py index 93fc3c14..3ac118e6 100644 --- a/dwave/system/warnings.py +++ b/dwave/system/warnings.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Provides classes and functions for warnings.""" import enum import logging