Repository navigation
Closed
Labels
numpyBugs and feature requests regarding NumPy support
Description
Below I have provided some links to get started and then explained what you both are supposed to do,
Links to get started
- https://github.com/lcompilers/lpython/blob/main/src/runtime/lpython_intrinsic_numpy.py - Contains definitions of
sin,cos,tan,log,log2,log10,sqrtforf32andf64types. Some points to be noted - i)@vectorizedecorator automatically vectorizes the function. Now by "vectorizes the function" I mean even if the functions are defined for single number input and single number outputs, you can call them upon are array inputs as well. - https://github.com/lcompilers/lpython/blob/main/integration_tests/elemental_01.py, https://github.com/lcompilers/lpython/blob/main/integration_tests/elemental_04.py - These are the test files for NumPy functions. You can see how
sin,cos,logare called with array inputs even though they were defined for single input and single output.@vectorizedoes the job for you. You can also notice how the functions are tested. You can make the tests as natural/complicated as you want to. For example for testingsin,cossimultaneously, you can just verifysin(array)**2 + cos(array)**2 == 1. Similarly for trigonometric function, you can take a few trigonometric identities and try verifying them in the tests (with 1d, 2d, 5d, 6d, etc arrays as inputs). In fact you can also try finding the derivative of functions using arrays. For example for a functionf, you can do(f(array + harray) - f(array))/harrayand match with the formula you know for derivative offyou know. Bottomline is you can use your creativity to the full extent to write interesting test cases. In case you get errors don't work around the test case, instead let me know and I will fix the error for you.
Overall this task is easy-medium. Easy because extending src/runtime/lpython_intrinsic_numpy.py is fairly easy (just follow the already existing pattern) and medium because writing test cases requires some creativity and effort.
What you have to do?
-
sinh- Sinh & cosh numpy_intrinsic functions implemented #1002 -
cosh- Sinh & cosh numpy_intrinsic functions implemented #1002 -
tanh- Implement tanh and exp in Numpy_intrinsic library #1064 -
exp- Implement tanh and exp in Numpy_intrinsic library #1064 -
arcsinh -
arccosh -
arctanh -
fix -
floor -
ceil -
trunc
If you complete the above tasks then please let me know. Feel free to reach out if you have any questions. :-)
Metadata
Metadata
Assignees
Labels
numpyBugs and feature requests regarding NumPy support
Activity
czgdp1807 commentedon Aug 12, 2022
@Madhav2310 Assigning this to you (I cannot assign non-members of
lcompilersGithub organisation so consider this as the assignment)Madhav2310 commentedon Aug 30, 2022
[-]Implementing hyperbolic trigonometric and exponential functions in NumPy[/-][+]Implementing hyperbolic trigonometric, exponential and rounding functions in NumPy[/+]khushi-411 commentedon Sep 5, 2023
Hi, @czgdp1807! I'd like to work on these functions and get familiar with the codebase. The Lpython project looks interesting to me! Just wondering if I could pick the issue. Thanks :-)
certik commentedon Sep 5, 2023
@khushi-411 you don't need to ask, just do it.
Many of these are already implemented, but I am sure many are still missing.
khushi-411 commentedon Sep 20, 2023
Hi, @certik @czgdp1807!
I think this issue could be closed as all the functions mentioned here are completed. Link
Just wanted to share. Thanks!
certik commentedon Sep 20, 2023
Excellent, great job!
khushi-411 commentedon Sep 20, 2023
Thanks for all your helpful suggestions, @certik!