Add Moore curve support with efficient LUT implementation#19
Open
Add Moore curve support with efficient LUT implementation#19
Conversation
- Added xy2h_moore() and h2xy_moore() functions for Moore curve transformations - Refactored xy2h() and h2xy() to use internal helper functions (xy2h_lut3 and h2xy_lut3) - Updated UnsignedBase trait with additional constants (ONE, TWO, THREE, SIXTY_THREE, BITS) and PartialEq bound - Removed redundant SEVEN and SIXTY_THREE constants from Unsigned trait implementations - Added comprehensive tests for Moore curve functions - Added panic documentation for Moore functions - Updated README to document Moore curve support - All tests pass and code is clippy-clean Co-authored-by: becheran <22472855+becheran@users.noreply.github.com>
- Removed unnecessary where clause from xy2h_moore function - Kept type annotation on shift operation as required by compiler Co-authored-by: becheran <22472855+becheran@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for Hilbert derivatives and variants
Add Moore curve support with efficient LUT implementation
Dec 11, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements Moore curve variant (closed-loop Hilbert derivative) while maintaining fast_hilbert's performance characteristics. Moore curves use the same 4-state LUT approach as standard Hilbert curves but with different state transitions and an initial order handling.
API Changes
Added two public functions:
xy2h_moore(x, y, order)- 2D → 1D Moore curve transformationh2xy_moore(h, order)- 1D → 2D Moore curve transformationImplementation
Refactored core functions - Extracted
xy2h_lut3()andh2xy_lut3()internal helpers to share logic between Hilbert and Moore implementations. Both variants now use the same optimized LUT-based algorithm with different state transition tables.Extended UnsignedBase trait - Added
ONE,TWO,THREE,SIXTY_THREE,BITSconstants andPartialEqbound required for Moore curve state logic. Removed redundant constants fromUnsignedtrait implementations.Moore-specific LUTs - Pre-computed 256-byte lookup tables for Moore curve state transitions, matching the memory footprint of standard Hilbert LUTs.
Performance
Benchmarks confirm no regression:
Maintains 2.4× speed advantage over nearest competitor.
Note on Liu Variants
Liu's other variants (Liu1-4) require >4 states and cannot be efficiently implemented with the 4-state LUT approach. Moore succeeds because it uses the same 4-state system with different transitions.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.