-
Notifications
You must be signed in to change notification settings - Fork 7
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
[FEAT] Implement NDArray::cumprod and NDArray::cumsum Closes #45 & Closes #46 #67
Open
jiyo4476
wants to merge
10
commits into
NumPower:main
Choose a base branch
from
jiyo4476:46-feat-implement-NDArray-cumprod
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
[FEAT] Implement NDArray::cumprod and NDArray::cumsum Closes #45 & Closes #46 #67
jiyo4476
wants to merge
10
commits into
NumPower:main
from
jiyo4476:46-feat-implement-NDArray-cumprod
Conversation
This file contains 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
This commit adds comprehensive test cases to ensure the correctness of the cumprod function. The new tests cover a variety of input scenarios, including: - Empty arrays - Arrays with a single element - Arrays with multiple elements - Inputs with different axis
…s 0 in ndarray cumprod **Commit Description:** - Updated test cases to correctly validate the cumulative product function for the default implementation. - Added test cases to verify the cumulative product along axis 0. - Ensured that the expected output matches the actual output for both scenarios. - Refactored test data to improve readability and maintainability. **Commit Subject:** Fix test cases for default implementation and axis 0 in ndarray cumprod **Commit Description:** - Updated test cases to correctly validate the cumulative product function for the default implementation. - Added test cases to verify the cumulative product along axis 0. - Ensured that the expected output matches the actual output for both scenarios. - Refactored test data to improve readability and maintainability.
…**Commit Description:** - Added the function declaration for `NDArray_Cum_Prod_Float` in [`arithmetics.h`](command:_github.copilot.openRelativePath?%5B%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22%22%2C%22path%22%3A%22%2FC%3A%2FUsers%2Fjimmy%2Fgithub%2Fnumpower%2Fnumpower%2Fsrc%2Fndmath%2Farithmetics.h%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%5D "c:\Users\jimmy\github\numpower\numpower\src\ndmath\arithmetics.h"). - Created a base empty definition for `NDArray_Cum_Prod_Float` to serve as a placeholder for future implementation. - Ensured the code compiles without errors after adding the new function declaration and definition + Added the function declaration for NDArray_Cum_Prod_Float in arithmetics.h + Created a base empty definition for NDArray_Cum_Prod_Float to serve as a placeholder for future implementation.
… support all data types - Registered the cumProd method as a PHP function to enable its usage in PHP scripts - Modified the declartion and definition of NDArray_Cum_Prod to support various data types and to take pointer in for axis
+ Implemented the cumProd function in arithmetics.c to compute the cumulative product along the specified axis. + Added logic to handle cumulative product computation for both flattened arrays and along specified axes (0 and 1). + Updated test suite to verify the correct output of the cumProd function. - Verified that all tests pass successfully, confirming the correctness of the implementation.
+ Refactored the cumProd function in arithmetics.c to use vectorized operations for improved performance. + Verified that the refactored function produces the correct cumulative product results
… with cumSum + Refactored the NDArray_Cum_Prod to multiple functions allowing for operations to be passed as parameters. + Introduced NDArray_Cum_Axis and NDArray_Cum_Flat to handle cumulative operations. + Added float_sum and float_product to allow them to be passed as parameters for NDArray_Cum_Flat and NDArray_Cum_Axis. + Ensured that the refactored functions maintain their original functionality and correctness. + Verified that all tests pass successfully, confirming the correctness of the refactor and new functionality.
+ Added the NDArray_Cum_Sum function to perform cumulative sum operations on NDArray objects. + Exposed the NDArray_Cum_Sum function to PHP via the cumSum method in numpower class. + Implemented the cumSum method to handle optional axis parameters, where the default operation will be on a flattened matrix. + Ensured that the new functionality integrates seamlessly with existing NDArray operations and maintains overall code integrity. + Added test cases for cumSum function to confirm correctness. + Verified that all tests pass successfully, confirming the correctness of the new cumulative sum functionality.
This was referenced Sep 29, 2024
+ Moved freeing pointers to different order to free sooner. + Tested to make sure functionality is correct after refactor.
+ Refactored the code in arithmetics.c to improve memory management by ensuring NDArrays are freed appropriately. + Ensured that all dynamically allocated NDArrays are freed to prevent memory leaks. + Verified that the function maintains its original functionality and correctness. + Confirmed that all tests pass successfully, ensuring the correctness of the changes.
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.
Submission Checklist:
Due to the inherent complexity of this library, we created this checklist to remind everyone of the essential steps to have an MR approved depending on the type of change that is made. You can delete this.
export USE_ZEND_ALLOC=1 && make test
export USE_ZEND_ALLOC=0 && make test
Change to methods and operations
NDARRAY_VCHECK
option enabled and no VRAM memory leaks were displayed?export NDARRAY_VCHECK=1 && make test
Changes to Core Components:
This include changes to:
buffer.c
,gpu_alloc.c
,ndarray.c
,iterators.c
and their associated header files.