dwave-preprocessing 0.6.8__tar.gz → 0.6.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dwave-preprocessing-0.6.8/dwave_preprocessing.egg-info → dwave-preprocessing-0.6.10}/PKG-INFO +1 -1
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/__init__.py +1 -1
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/spin_reversal_transform.py +62 -20
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/cypresolve.cpp +2 -2
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10/dwave_preprocessing.egg-info}/PKG-INFO +1 -1
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/SOURCES.txt +0 -1
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/pyproject.toml +12 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/setup.cfg +4 -5
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/setup.py +5 -4
- dwave-preprocessing-0.6.8/dwave/__init__.py +0 -16
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/LICENSE +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/MANIFEST.in +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/README.rst +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/__init__.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/clip.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/connected_components.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/fix_variables.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/scale.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/cyfix_variables.cpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/cyfix_variables.pyx +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave/exceptions.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave/flags.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave/presolve.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/fix_variables.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/helper_data_structures.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/helper_graph_algorithms.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/implication_network.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/mapping_policy.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/posiform_info.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave-preprocessing/push_relabel.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/libcpp.pxd +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/lower_bounds.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/__init__.pxd +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/__init__.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/cypresolve.pxd +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/cypresolve.pyx +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/exceptions.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/pypresolve.py +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/exceptions.cpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/presolve.cpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/presolveimpl.hpp +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/dependency_links.txt +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/not-zip-safe +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/requires.txt +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/top_level.txt +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/LICENSE +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/async.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/async_logger-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/async_logger.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/argv.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/env.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/helpers-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/helpers.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/common-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/common.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/backtracer-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/backtracer.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/circular_q.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/console_globals.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/file_helper-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/file_helper.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/fmt_helper.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/log_msg-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/log_msg.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/log_msg_buffer-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/log_msg_buffer.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/mpmc_blocking_q.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/null_mutex.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/os-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/os.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/periodic_worker-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/periodic_worker.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/registry-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/registry.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/synchronous_factory.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/tcp_client-windows.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/tcp_client.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/thread_pool-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/thread_pool.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/udp_client-windows.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/udp_client.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/windows_include.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bin_to_hex.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/args.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/chrono.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/color.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/compile.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/core.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/fmt.license.rst +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/format-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/format.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/locale.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/os.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/ostream.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/printf.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/ranges.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/bundled/xchar.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/chrono.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/compile.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/fmt.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/ostr.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/ranges.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/xchar.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/formatter.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fwd.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/logger-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/logger.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/pattern_formatter-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/pattern_formatter.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/android_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/ansicolor_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/base_sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/base_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/basic_file_sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/basic_file_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/daily_file_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/dist_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/dup_filter_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/hourly_file_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/mongo_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/msvc_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/null_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/ostream_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/qt_sinks.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/ringbuffer_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/rotating_file_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/stdout_color_sinks.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/stdout_sinks-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/stdout_sinks.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/syslog_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/systemd_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/tcp_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/udp_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/win_eventlog_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/wincolor_sink-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/wincolor_sink.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/spdlog-inl.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/spdlog.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/stopwatch.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/tweakme.h +0 -0
- {dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/version.h +0 -0
|
@@ -131,12 +131,14 @@ class SpinReversalTransformComposite(ComposedSampler):
|
|
|
131
131
|
(sampleset.record.sample[:, reorder], order),
|
|
132
132
|
sort_labels=False,
|
|
133
133
|
vartype=sampleset.vartype,
|
|
134
|
+
info=sampleset.info,
|
|
134
135
|
**sampleset.data_vectors,
|
|
135
136
|
)
|
|
136
137
|
|
|
137
138
|
@dimod.decorators.nonblocking_sample_method
|
|
138
139
|
def sample(self, bqm: dimod.BinaryQuadraticModel, *,
|
|
139
|
-
|
|
140
|
+
srts: typing.Optional[np.ndarray] = None,
|
|
141
|
+
num_spin_reversal_transforms: typing.Optional[int] = None,
|
|
140
142
|
**kwargs,
|
|
141
143
|
):
|
|
142
144
|
"""Sample from the binary quadratic model.
|
|
@@ -144,55 +146,91 @@ class SpinReversalTransformComposite(ComposedSampler):
|
|
|
144
146
|
Args:
|
|
145
147
|
bqm: Binary quadratic model to be sampled from.
|
|
146
148
|
|
|
149
|
+
srts: A boolean NumPy array with shape
|
|
150
|
+
``(num_spin_reversal_transforms, bqm.num_variables)``.
|
|
151
|
+
True indicates a flip and False indicates no flip; applied to
|
|
152
|
+
in the order given by ``bqm.variables``.
|
|
153
|
+
If this is not specified as an input values are generated uniformly
|
|
154
|
+
at random from the class pseudo-random number generator.
|
|
155
|
+
|
|
147
156
|
num_spin_reversal_transforms:
|
|
148
157
|
Number of spin reversal transform runs.
|
|
149
158
|
A value of ``0`` will not transform the problem.
|
|
150
159
|
If you specify a nonzero value, each spin reversal transform
|
|
151
160
|
will result in an independent run of the child sampler.
|
|
161
|
+
If ``srts`` is set then ``num_spin_reversal_transforms``
|
|
162
|
+
is inferred by the shape, otherwise the default is 1.
|
|
152
163
|
|
|
153
164
|
Returns:
|
|
154
165
|
A sample set. Note that for a sampler that returns ``num_reads`` samples,
|
|
155
166
|
the sample set will contain ``num_reads*num_spin_reversal_transforms`` samples.
|
|
156
167
|
|
|
168
|
+
Raises:
|
|
169
|
+
ValueError: If ``srts`` is inconsistent with
|
|
170
|
+
``num_spin_reversal_transforms`` or the binary quadratic model.
|
|
171
|
+
|
|
157
172
|
Examples:
|
|
158
|
-
This example runs
|
|
173
|
+
This example runs 10 spin reversals applied to an unfrustrated chain
|
|
174
|
+
of length 6.
|
|
175
|
+
|
|
176
|
+
Using the lowest energy (ground) state returned, you can define a
|
|
177
|
+
special SRT that transforms all programmed couplers to be ferromagnetic
|
|
178
|
+
(ground state to all 1).
|
|
159
179
|
|
|
160
180
|
>>> from dimod import ExactSolver
|
|
181
|
+
>>> import numpy as np
|
|
161
182
|
>>> from dwave.preprocessing.composites import SpinReversalTransformComposite
|
|
162
183
|
>>> base_sampler = ExactSolver()
|
|
163
184
|
>>> composed_sampler = SpinReversalTransformComposite(base_sampler)
|
|
164
185
|
...
|
|
165
|
-
>>>
|
|
166
|
-
>>>
|
|
167
|
-
|
|
168
|
-
>>>
|
|
169
|
-
|
|
186
|
+
>>> num_var = 6
|
|
187
|
+
>>> num_spin_reversal_transforms = 10
|
|
188
|
+
>>> J = {(i, i+1): np.random.choice([-1,1]) for i in range(num_var-1)}
|
|
189
|
+
>>> h = {i: 0 for i in range(num_var)}
|
|
190
|
+
>>> response = composed_sampler.sample_ising(h, J,
|
|
191
|
+
... num_spin_reversal_transforms=num_spin_reversal_transforms)
|
|
192
|
+
>>> len(response) == 2**num_var * num_spin_reversal_transforms
|
|
193
|
+
True
|
|
194
|
+
>>> srts = np.array([[response.first.sample[i] != 1 for i in range(num_var)]])
|
|
195
|
+
>>> response = composed_sampler.sample_ising(h, J,
|
|
196
|
+
... srts=srts, num_reads=1)
|
|
197
|
+
>>> sum(response.record.num_occurrences) == 2**num_var
|
|
198
|
+
True
|
|
170
199
|
"""
|
|
171
200
|
sampler = self._child
|
|
172
201
|
|
|
202
|
+
if srts is not None:
|
|
203
|
+
nsrt, num_bqm_var = srts.shape
|
|
204
|
+
if num_bqm_var != bqm.num_variables:
|
|
205
|
+
raise ValueError('srt shape is inconsistent with the bqm')
|
|
206
|
+
if num_spin_reversal_transforms is not None:
|
|
207
|
+
if num_spin_reversal_transforms != nsrt:
|
|
208
|
+
raise ValueError('srt shape is inconsistent with num_spin_reversal_transforms')
|
|
209
|
+
else:
|
|
210
|
+
num_spin_reversal_transforms = nsrt
|
|
211
|
+
elif num_spin_reversal_transforms is None:
|
|
212
|
+
num_spin_reversal_transforms = 1
|
|
213
|
+
|
|
173
214
|
# No SRTs, so just pass the problem through
|
|
174
|
-
if
|
|
215
|
+
if num_spin_reversal_transforms == 0 or not bqm.num_variables:
|
|
175
216
|
sampleset = sampler.sample(bqm, **kwargs)
|
|
176
217
|
# yield twice because we're using the @nonblocking_sample_method
|
|
177
218
|
yield sampleset # this one signals done()-ness
|
|
178
219
|
yield sampleset # this is the one actually used by the user
|
|
179
220
|
return
|
|
180
221
|
|
|
222
|
+
if srts is None:
|
|
223
|
+
srts = self.rng.random((num_spin_reversal_transforms, bqm.num_variables)) > .5
|
|
224
|
+
|
|
181
225
|
# we'll be modifying the BQM, so make a copy
|
|
182
226
|
bqm = bqm.copy()
|
|
183
227
|
|
|
184
|
-
# We maintain the Leap behavior that num_spin_reversal_transforms == 1
|
|
185
|
-
# corresponds to a single problem with randomly flipped variables.
|
|
186
|
-
|
|
187
|
-
# Get the SRT matrix
|
|
188
|
-
SRT = self.rng.random((num_spin_reversal_transforms, bqm.num_variables)) > .5
|
|
189
|
-
|
|
190
228
|
# Submit the problems
|
|
191
229
|
samplesets: typing.List[dimod.SampleSet] = []
|
|
192
230
|
flipped = np.zeros(bqm.num_variables, dtype=bool) # what variables are currently flipped
|
|
193
231
|
for i in range(num_spin_reversal_transforms):
|
|
194
232
|
# determine what needs to be flipped
|
|
195
|
-
transform = flipped !=
|
|
233
|
+
transform = flipped != srts[i, :]
|
|
196
234
|
|
|
197
235
|
# apply the transform
|
|
198
236
|
for v, flip in zip(bqm.variables, transform):
|
|
@@ -212,12 +250,16 @@ class SpinReversalTransformComposite(ComposedSampler):
|
|
|
212
250
|
# Undo the SRTs according to vartype
|
|
213
251
|
if bqm.vartype is Vartype.BINARY:
|
|
214
252
|
for i, sampleset in enumerate(samplesets):
|
|
215
|
-
sampleset.record.sample[:,
|
|
253
|
+
sampleset.record.sample[:, srts[i, :]] = 1 - sampleset.record.sample[:, srts[i, :]]
|
|
216
254
|
elif bqm.vartype is Vartype.SPIN:
|
|
217
255
|
for i, sampleset in enumerate(samplesets):
|
|
218
|
-
sampleset.record.sample[:,
|
|
256
|
+
sampleset.record.sample[:, srts[i, :]] *= -1
|
|
219
257
|
else:
|
|
220
258
|
raise RuntimeError("unexpected vartype")
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
259
|
+
if num_spin_reversal_transforms == 1:
|
|
260
|
+
# If one sampleset, return full information
|
|
261
|
+
# (info returned in full)
|
|
262
|
+
yield samplesets[0]
|
|
263
|
+
else:
|
|
264
|
+
# finally combine all samplesets together
|
|
265
|
+
yield dimod.concatenate(samplesets)
|
|
@@ -26,3 +26,15 @@ archs = "x86_64 arm64"
|
|
|
26
26
|
archs = "AMD64"
|
|
27
27
|
before-build = "pip install delvewheel>=1.4.0"
|
|
28
28
|
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel} --namespace-pkg dwave"
|
|
29
|
+
|
|
30
|
+
[tool.coverage.run]
|
|
31
|
+
omit = ["tests/*"]
|
|
32
|
+
source_dirs = ["dwave/preprocessing"]
|
|
33
|
+
|
|
34
|
+
[tool.coverage.report]
|
|
35
|
+
include_namespace_packages = true
|
|
36
|
+
exclude_lines = [
|
|
37
|
+
"pragma: no cover",
|
|
38
|
+
"raise NotImplementedError",
|
|
39
|
+
"if __name__ == .__main__.:",
|
|
40
|
+
]
|
|
@@ -24,14 +24,13 @@ description = An API for preprocessing tools
|
|
|
24
24
|
|
|
25
25
|
[options]
|
|
26
26
|
include_package_data = True
|
|
27
|
-
packages =
|
|
28
|
-
dwave
|
|
29
|
-
dwave.preprocessing
|
|
30
|
-
dwave.preprocessing.composites
|
|
31
|
-
dwave.preprocessing.presolve
|
|
27
|
+
packages = find_namespace:
|
|
32
28
|
python_requires = >=3.9
|
|
33
29
|
zip_safe = False
|
|
34
30
|
|
|
31
|
+
[options.packages.find]
|
|
32
|
+
include = dwave.*
|
|
33
|
+
|
|
35
34
|
[pycodestyle]
|
|
36
35
|
max-line-length = 100
|
|
37
36
|
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import os
|
|
16
16
|
|
|
17
|
-
from setuptools import setup
|
|
18
|
-
from setuptools.extension import Extension
|
|
17
|
+
from setuptools import setup, Extension
|
|
19
18
|
from setuptools.command.build_ext import build_ext as _build_ext
|
|
20
19
|
|
|
21
20
|
import dimod
|
|
@@ -53,8 +52,10 @@ setup(
|
|
|
53
52
|
name='dwave-preprocessing',
|
|
54
53
|
cmdclass=dict(build_ext=build_ext),
|
|
55
54
|
ext_modules=cythonize(
|
|
56
|
-
['dwave
|
|
57
|
-
|
|
55
|
+
[Extension('dwave.preprocessing.cyfix_variables',
|
|
56
|
+
['dwave/preprocessing/cyfix_variables.pyx']),
|
|
57
|
+
Extension('dwave.preprocessing.presolve.cypresolve',
|
|
58
|
+
['dwave/preprocessing/presolve/cypresolve.pyx']),
|
|
58
59
|
],
|
|
59
60
|
annotate=True,
|
|
60
61
|
nthreads=int(os.getenv('CYTHON_NTHREADS', 0)),
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright 2021 D-Wave Systems Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
import pkgutil
|
|
16
|
-
__path__ = pkgutil.extend_path(__path__, __name__)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/__init__.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/clip.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/composites/scale.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/cyfix_variables.cpp
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/cyfix_variables.pyx
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/include/dwave/flags.hpp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/lower_bounds.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/__init__.pxd
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/__init__.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/cypresolve.pxd
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/cypresolve.pyx
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/exceptions.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/presolve/pypresolve.py
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/exceptions.cpp
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/presolve.cpp
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave/preprocessing/src/presolveimpl.hpp
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/requires.txt
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/dwave_preprocessing.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/async.h
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/async_logger.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/argv.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/env.h
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/cfg/helpers.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/common-inl.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/common.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/details/os.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/chrono.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/compile.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/fmt.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/ostr.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/ranges.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/fmt/xchar.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/formatter.h
RENAMED
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/logger-inl.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/logger.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/sinks/sink.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/spdlog-inl.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/spdlog.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/stopwatch.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/tweakme.h
RENAMED
|
File without changes
|
{dwave-preprocessing-0.6.8 → dwave-preprocessing-0.6.10}/extern/spdlog/include/spdlog/version.h
RENAMED
|
File without changes
|