-
Notifications
You must be signed in to change notification settings - Fork 45
Zephyr utils #261
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
Open
mahdiehmalekian
wants to merge
128
commits into
dwavesystems:main
Choose a base branch
from
mahdiehmalekian:zephyr-utils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Zephyr utils #261
Changes from 70 commits
Commits
Show all changes
128 commits
Select commit
Hold shift + click to select a range
4c7a75a
Initial commit
2628061
Reformat
ef9f800
Reformat
a394ead
Allow Edge input to be any type, not just int + Add check_edge_valid …
cdeeff8
Turn off check_edge_valid flag for _edges attribute in ZSurvey
e6eca6d
Correct header
20b79d0
Add NodeKind and EdgeKind and adjust; Add document
4a699f2
Reformat
fd78154
Explicitly return None
9f7e5ab
Simplify, Add space
13a29b4
Clarify arguments
mahdiehmalekian a15e92b
Capitalize
mahdiehmalekian 94e85be
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 904a4a3
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian bb8afc9
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 0f4a1bd
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian c53380d
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 974489c
Clarify documentation, set shape in init
70d84ed
Add doc to EdgeKind, NodeKind, clarify doc re. direction, Change name
03765f1
Edit document
edfde0f
Change nbr_kind argument type
7a8da7e
Add edge_kind to ZEdge
f525e25
Disable changing znodes of QuoTile, change Dim to Dim_2D
d496bfc
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian b415ad3
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian bd461a4
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 4a1f63d
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian e1ea6c6
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 36f39c7
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 0f3c70d
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 04df704
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian abd56fa
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 1bc85f0
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 4f86bdc
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 5c1c0f1
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian 9c2b0c8
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian 7c29e5f
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian 2479071
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian eee8d40
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian e2a891b
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian e05fe41
Update minorminer/utils/zephyr/survey.py
mahdiehmalekian db9b0d9
Update minorminer/utils/zephyr/coordinate_systems.py
mahdiehmalekian c6c7c72
Update minorminer/utils/zephyr/coordinate_systems.py
mahdiehmalekian 3cbeec1
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 166cf15
Update minorminer/utils/zephyr/qfloor.py
mahdiehmalekian 628610a
Update minorminer/utils/zephyr/qfloor.py
mahdiehmalekian 7125603
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 486d8fa
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 5886529
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 26191b1
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian fd295aa
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 8ee09a7
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 66e65ba
capitalize
659c815
Update docstring
c9a8d35
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian d0fe844
Disable 'float' scale
3365f07
Correct header
5ef99a2
Add, correct documentation
241667a
Add, correct documentation
1a8b937
Correct documentation
7cd6fbc
Correct documentation
b47c876
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian cc2e009
Correct documentation
a56aa84
Disable shape.setter, coord.setter + Separate checks for ccoord + Mod…
8d6c974
Edit docstrings
b8a3565
Fix bug
eeaf537
Add check node validity flag
7f6aa26
Edit examples
e2df11d
Remove unused files
27c829b
Refactor, Add documentation
c9cdb6d
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 7614def
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 06c04ed
Update tests/utils/zephyr/test_plane_shift.py
mahdiehmalekian 8120074
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 6363001
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 0489b5d
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian 3f03a6c
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian d08e023
Update minorminer/utils/zephyr/plane_shift.py
mahdiehmalekian c0af994
Update minorminer/utils/zephyr/node_edge.py
mahdiehmalekian b4bb9b3
Update tests/utils/zephyr/test_coordinate_systems.py
mahdiehmalekian 9f501b6
Update tests/utils/zephyr/test_node_edge.py
mahdiehmalekian 0e64a7d
Improve defaulting of max_num_emb; move basic helper function from fe…
jackraymond bc8bfef
Correct lattice_size signature per review request
jackraymond dd508ae
Simplify tiling branch behaviour (single fixed embedding). Add timeou…
jackraymond 898d16f
Add test of timeout
jackraymond fdafc0a
Restructure docs (minimal changes)
JoelPasvolsky 8938719
Update header and conf.py fixes
JoelPasvolsky 8fc86ec
Add Usage Info section, fix api_ref anchor
JoelPasvolsky 6884f02
Fix SDK build warning for repo (minimal until last rebase)
JoelPasvolsky 9bf15d1
Update theme and xrefs
JoelPasvolsky b79fc8a
Flatten ref structure
JoelPasvolsky 422813c
Fix missing C++ functions
JoelPasvolsky 14d0c60
Remove the ``find_embedding:189: ERROR: Unexpected indentation`` fro…
JoelPasvolsky 20b6ad6
Update missed path to readme
JoelPasvolsky eec527f
Turn off dot (graphviz) to prevent multiple build warnings
JoelPasvolsky 541f471
Remove leftover todo (thanks @thisac)
JoelPasvolsky e94fcbc
Fiddle with test_parallel_embeddings to satisfy arbitrary circleCI co…
jackraymond 2a09919
Make dwave.embedding optional dependency
jackraymond 630e0ee
basic version of imported function is_valid_embedding
jackraymond a35eefa
Correct variable names in fallover function
jackraymond 045ba05
random review: Update minorminer/utils/parallel_embeddings.py
jackraymond 554fe4b
Apply suggestions from code review
jackraymond e3b8de0
Implement randomir review recommendations
jackraymond 7eeaf45
Add test of array_to_embeddings
jackraymond 685a068
Delete redundant failover code
jackraymond 5c21048
Apply suggestions from code review
jackraymond a62934c
implement thisac review
jackraymond db8b95c
Remove obsolete doxygen configuration
JoelPasvolsky 219fcf4
Release 0.2.18
randomir 92e227a
Bugfix: replace full graph by local decimated graph for use tiling br…
jackraymond 9ed506a
Minor changes to docstrings and defaulting for compatibility/comprehe…
jackraymond 4c5515b
implement review changes to docstrings
jackraymond 19dff7b
Allow dwave_networkx to be passed as kwargs rather than in T
jackraymond 8af6832
Bugfix: remove None test for required List argument
jackraymond 6a06776
Apply suggestions from code review
jackraymond 4db164e
Fix Optional type hinting, fix handling of T=None code and tests
jackraymond 04171df
Release 0.2.19
randomir ac17efb
Added support for colorings in Glasgow subgraph solver (#272)
boothby 7697976
Glasgow Miscellany (#273)
boothby 72067f2
Add Python 3.14 and remove 3.9 support
thisac 449c067
Set default start method for multiprocessing to 'fork'
thisac 52a897a
Bump release to 0.2.20
thisac 4860b34
Update releasenote entry to fix reno parsing
thisac 1c088d6
Add keyboard interrupts for subgraph.find_subgraph (#275)
boothby 8223301
Increment version for release
thisac c14b7da
Include utils.zephyr in packages
d8c9790
Apply suggestions from code review
8912073
Merge remote-tracking branch 'upstream' into zephyr-utils
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2025 D-Wave | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # 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. | ||
| # | ||
| # ================================================================================================ | ||
|
|
||
| from minorminer.utils.zephyr.zephyr import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Copyright 2025 D-Wave | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # 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. | ||
| # | ||
| # ================================================================================================ | ||
|
|
||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from collections import namedtuple | ||
|
|
||
| zephyr_fields = ["u", "w", "k", "j", "z"] | ||
| ZephyrCoord = namedtuple("ZephyrCoord", zephyr_fields, defaults=(None,) * len(zephyr_fields)) | ||
| cartesian_fields = ["x", "y", "k"] | ||
| CartesianCoord = namedtuple( | ||
| "CartesianCoord", cartesian_fields, defaults=(None,) * len(cartesian_fields) | ||
| ) | ||
|
|
||
|
|
||
| def cartesian_to_zephyr(ccoord: CartesianCoord) -> ZephyrCoord: | ||
| """Converts a :class:`CartesianCoord` to its corresponding :class:`ZephyrCoord`. | ||
|
|
||
| Note: It assumes the given :class:`CartesianCoord` is valid. | ||
|
|
||
| Args: | ||
| ccoord (CartesianCoord): The coodinate in Cartesian system to be converted. | ||
|
|
||
| Returns: | ||
| ZephyrCoord: The coordinate of the ``ccoord`` in Zephyr system. | ||
| """ | ||
| x, y, k = ccoord | ||
| if x % 2 == 0: | ||
| u: int = 0 | ||
| w: int = x // 2 | ||
| j: int = ((y - 1) % 4) // 2 | ||
mahdiehmalekian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| z: int = y // 4 | ||
| else: | ||
| u: int = 1 | ||
| w: int = y // 2 | ||
| j: int = ((x - 1) % 4) // 2 | ||
| z: int = x // 4 | ||
| return ZephyrCoord(u=u, w=w, k=k, j=j, z=z) | ||
|
|
||
|
|
||
| def zephyr_to_cartesian(zcoord: ZephyrCoord) -> CartesianCoord: | ||
| """Converts a :class:`ZephyrCoord` to its corresponding :class:`CartesianCoord`. | ||
|
|
||
| Note: It assumes the given ``zcoord`` is a valid Zephyr coordinate. | ||
|
|
||
| Args: | ||
| zcoord (ZephyrCoord): The coodinate in Zephyr system to be converted. | ||
|
|
||
| Returns: | ||
| CartesianCoord: The coordinate of the ``ccoord`` in Cartesian system. | ||
| """ | ||
| u, w, k, j, z = zcoord | ||
| if u == 0: | ||
| x = 2 * w | ||
| y = 4 * z + 2 * j + 1 | ||
| else: | ||
| x = 4 * z + 2 * j + 1 | ||
| y = 2 * w | ||
| return CartesianCoord(x=x, y=y, k=k) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.