-
Notifications
You must be signed in to change notification settings - Fork 0
Add operation dispatch system with C++ backend and Cython wrapper #35
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
Merged
Conversation
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
Co-authored-by: joocer <1688479+joocer@users.noreply.github.com>
Co-authored-by: joocer <1688479+joocer@users.noreply.github.com>
Co-authored-by: joocer <1688479+joocer@users.noreply.github.com>
Co-authored-by: joocer <1688479+joocer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add operation dispatch function for handling operations
Add operation dispatch system with C++ backend and Cython wrapper
Oct 12, 2025
Member
|
@copilot we only need List, list |
…lar, and scalar-scalar Co-authored-by: joocer <1688479+joocer@users.noreply.github.com>
Contributor
Author
Updated to support only the required combinations: vector-vector, vector-scalar, and scalar-scalar. Scalar-vector operations now return None (not supported). Changes in commit 2b1d7e4. |
|
📦 Draken build version: |
1 similar comment
|
📦 Draken build version: |
|
📦 Draken build version: |
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.
Overview
Implements a type-safe operation dispatch system that determines if binary operations are supported for given type combinations. The implementation provides a C++ backend for performance with a Cython wrapper for Python accessibility.
What's New
Main API Function
Returns
Noneif the operation is not supported for the given type combination, otherwise returns a function pointer.Usage Example
Implementation Details
C++ Backend (Performance)
DrakenOperationenum and function pointer typesNULLfor unsupported operationsCython Wrapper (Python Access)
TYPE_INT64,TYPE_BOOL,TYPE_FLOAT64, etc.)Supported Operations
Arithmetic:
add,subtract,multiply,divideComparison:
equals,not_equals,greater_than,greater_than_or_equals,less_than,less_than_or_equalsBoolean:
and,or,xorType Compatibility Rules
None.Testing
Added comprehensive test suite with 19 tests covering:
Documentation
Files Changed
Added:
draken/core/ops.h- C++ headerdraken/core/ops_impl.cpp- C++ implementationdraken/core/ops.pxd- Cython declarationsdraken/core/ops.pyx- Python wrappertests/test_ops_dispatch.py- Test suitedocs/operation_dispatch.md- Documentationexamples/operation_dispatch_example.py- ExamplesIMPLEMENTATION.md- SummaryModified:
setup.py- Added C++ extension configurationFuture Enhancements
The current implementation validates type compatibility and returns
Nonefor all cases. Future work could extend this to return actual C++ function pointers for direct operation execution, further improving performance.Closes #[issue_number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.