Add el-geometry - #289
Conversation
|
While this module works with the concept of Zephyr Cartesian coordinates introduced in dwavesystems/dwave-graphs#275, this module is independent of that PR. |
|
Note to reviewers: This is the first of a series. Subsequent clique-embedder PRs depend on this PR and can only follow once this merges. So would much appreciate a speedy review. |
|
Undid the creation of |
| x_sign = 1 if v_x > h_x else -1 | ||
| y_sign = 1 if h_y > v_y else -1 | ||
| hp_x = v_x - x_sign if (x_diff & 3) == 1 else v_x + x_sign | ||
| if hp_x < 0 or hp_x > abs_max: |
There was a problem hiding this comment.
I think it would be worthwhile to have some additional input validation, such as ensuring v_x and v_y have opposite parity.
There was a problem hiding this comment.
For this module, performance is the top priority. And this parity check will be ensured in the caller (to come in a subsequent PR) of this function.
|
|
||
|
|
||
| class TestElbow(unittest.TestCase): | ||
| # (m, vx, vy, hx, hy, expected): expected is the (vp_y, hp_x) elbow, or None |
There was a problem hiding this comment.
I would use a docstring here instead (and for the rest of the classes)
There was a problem hiding this comment.
That is a comment for its following list, not for the class. Also, for the rest of such instances. I put a blank line between class definition and such comments in a527edc to make this clear.
Introduces a new package tree for clique embedder and adds the first module,
el_geometry.py, which implements the pure geometry of the L-shaped ("el") templates used to build clique embeddings on a defected Zephyr graph.Changes
minorminer/embedders/__init__.pyminorminer/embedders/clique/__init__.pyminorminer/embedders/clique/_zephyr/__init__.pyNew module
minorminer/embedders/clique/_zephyr/el_geometry.pycomputes ideal el-template geometry for Zephyr. All functions arek-agnostic (quotient) and depend only on the Zephyr grid sizemand the ideal topology, not on the tile sizetor on which nodes/edges a specific graph contains. Uses Zephyr Cartesian(x, y, k)coordinates followingdwave.graphs.ZephyrCartesianCoord.Matching tests:
tests/embedders/__init__.py,tests/embedders/clique/__init__.py,tests/embedders/clique/zephyr/__init__.py,tests/embedders/clique/zephyr/test_el_geometry.pyNote
This is the first piece of a larger Zephyr clique-embedder effort; it lands the geometry layer only, with no public API wired up yet.
AI use
Used AI to clean up my code and complete, edit documentation. Also used it to write the test suite. Checked and edited everything myself.