Skip to content

[RFC]: Develop C implementations for Base Special math functions #113

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

Open
7 tasks done
sahil20021008 opened this issue Mar 23, 2025 · 5 comments
Open
7 tasks done
Labels
2025 2025 GSoC proposal. received feedback A proposal which has received feedback. rfc Project proposal.

Comments

@sahil20021008
Copy link

sahil20021008 commented Mar 23, 2025

Full name

Sahil Goyal

University status

No

University name

No response

University program

No response

Expected graduation

No response

Short biography

I have completed my BTech in Computer Science and Applied Mathematics from Indraprastha Institute of Information Technology Delhi, and I am currently working in Oracle.
I am proficient in Python, C, C++, Java, SQL, Perl, and have some experience in HTML, CSS, Javascript and Node
My work has been mostly in Python, SQL and Perl, along with Ui development on Oracle APEX. I have worked on automating the Bug filing process and migration of our APIs from Perl to Python.
I have also done research under Dr Arani Bhattacharya in college where I worked on FlexDisplay project that would alter Android source code in order to reduce mobile battery consumption by preventing rendering of unnecessary UI elements.
I am interested in Machine Learning, Artificial Intelligence, and Android Development.
I am also very interested to work on open source projects as I believe this would help me get introduced to Open Source Field, and it would also help me keep up-to-date with the latest industry standards and practices and let me have more hands on coding practice, and also learn about the latest technologies.

SahilGoyalResume 6.pdf

Timezone

Indian Standard Time ( IST ), UTC+05:30

Contact details

email:[email protected],github:sahil20021008

Platform

Windows

Editor

VSCode

This is because VSCode is an extremely lightweight and highly customizable editor. It allows us to use all kinds of extensions, which makes it highly versatile and helps maintain proper code quality
Additionally, it is widely used because of which if someone runs into a problem there are a lot of references online as someone else has usually faced the same problem before, and it has a huge online community.

Programming experience

I am proficient in different languages like Python, C, C++, SQL, Perl, Java, Javascript and Node. I also have experience with online website development through Oracle APEX, and have worked on making small website as part of my college project.

During second half of college, I participated in a research project under professor Dr. Arani Bhattacharya and Dr. Mukulika Maity to work on the FlexDisplay Project where we worked on altering the android source code in order to reduce mobile battery consumption by preventing the rendering of unnecessary UI elements. We published a short paper on it that I presented in PerCom 2024 conference in Biarritz, France.

m79317-goel paper.pdf

Fake News Detection: I have also worked on a machine learning project where we created a case study and compared the outputs based on different metrics for many different ML models to find out which one would be the best suited for the real life Liar Dataset.

BadaFone: Created a full stack web app for Database Management course. The frontend was created through HTML and CSS, while the backend used Python and MYSQL

I have also participated in contests such as Google Code Jam (Rank 3097) and Google Kickstart (Rank 8153 and 3702).

JavaScript experience

My most recent experience with JavaScript is contributing to stdlib repository and adding new packages.
Currently, the latest package i have been working on is adding is stdlib/math/base/special/minmaxabsf package which includes both JS and C implementations along with examples, benchmarks, tests, etc.
One of the best thing about JavaScript is the many kinds of different frameworks and the rich open source community and support one can get for them, such as React, Node, etc.
Theres not anything I can think of in particular that is a problem in JavaScript. One thing I think that can still be improved in JavaScript is adding more support for Artificial Intelligence. This is because nowadays, Artificial Intelligence is extremely popular, and currently, JavaScript does not have support for it nearly as much as there should be

Node.js experience

I have some basic experience with Node.js, including setting up a development environment, using npm for package management, and building simpler server side aplications. I have also studied event-driven architecture, asynchronous programming and non blocking I/O through online courses and some hand on practice.

C/Fortran experience

I have learned C in college 2nd year for my Operating Systems course. I have worked on modifying the linux kernel and adding and removing syscalls, and I have also completed a Computer Networks course in college, where I used C to create sockets and pipes for communication between different processes and threads.
CN assignments
OS assignments

Additionally, I have also worked on the C implementation for the benchmarks, examples, and the src file which contains the C implementations of the minmaxabsf function. while contributing to stdlib library.

I also have a basic understanding of fortran

Interest in stdlib

I really loved the idea of stdlib when I found out about it. An entire mathematical open source library for JavaScript. This will really increase accessibility and effectiveness and improve the popularity and support of Javascript in the world.
Additionally, I really like how well organized the library is: from implementing a specific format for all merges, to linting checks, it is really impressive to adhere to coding conventions that much, and I really liked the thought and effort that went into it. It is also very well thought out hoow easy it has been made for new developers to contribute to the stdlib library, from adding a dev container to adding multiple tests, etc.
The thing I liked the most about stdlib library is that the functions being implemented are core functions that will be used everywhere. Even small and minor functions will be picked up quickly, and there wont be as much of a reliance on other languages for such features as there was before. Thanks to this library, the effectiveness of javascript will skyrocket and it will become much more widespread than it already is.

Version control

Yes

Contributions to stdlib

Currently, I have raised a Pull Request for adding the implementation of stdlib/math/base/special/minmaxabsf, as well as a pull request to fix the array indexing issue in stdlib/math/base/special/gamma-lanczos-sum where we were trying to iterate over a number instead of an array due to an incorrect import.

This implementation includes C implementations, JavaScript implementation, tests, benchmarks (in both C, JS and Julia), examples, and docs.
This Pull Request is yet to be merged: stdlib-js/stdlib#6290
This Pull Request has been merged: stdlib-js/stdlib#6454

stdlib showcase

For showcase, I have created a scientific calculator. It can perform the basic calculations such as +, -, *, , and also has additional functions such as %, ln, reciprocal, square, sqrt, e^x^. It uses stdlib math/base/special functions for these calculations, and also has a feature where it can give the output in single-precision and double-precision floating point values according to the user's needs.
Scientific Calculator

Goals

I plan to complete many implementations for the stdlib/math/base/special functions.
The implementations will include implementations including complex numbers, single-precision and double-precision floating point numbers, etc.
This will greatly help JavaScript in the long run as it will be achieve a greater degree of self reliance compared to before, and wont have to rely on other languages such as Python for such features as it did in the past.
Moreover, I am also open to working on other packages such as the constants/float32 and constants/float64 package. This is because these are the base functionality packages, and adding single-precision implementations for these will have a huge impact on the implementation of the rest of the stdlib library, as these will be used everywhere and can help reduce a lot of hard work and effort in the future implementations and save a lot of developer hours.

Why this project?

The proposed project excites me because it is an open source library and will be used by developers everywhere. It includes adding functionalities that will help people in mathematical operations, writing algorithms, etc. This library will be widely used and it is an amazing thing, and I would really love to be a part of such an amazing project.
This project is also about implementing mathematical functions in JavaScript and C, and as I graduated in Computer Science and Applied Mathematics and have experience in both Software Development and Mathematical Functions, I believe this projects suits me properly and I will be able to properly contribute to this project.
Additionally, this will help me improve my own abilities, get familiar with open source standards and coding practices, etc.
I am also very excited to work with a welcoming and large community like the stdlib community, and work together and contribute with my mentors.

Qualifications

I graduated from college in the field or Computer Science and Applied Mathematics. Thats why, I believe that I have good experience with both mathematics and in Computer Science. I have taken courses such as Statistical Inferencce, Probability and Statistics, Linear Algebra, etc., because of which I have a lot of experience with such mathematical functions.

This project will involve me working in C, JavaScript, Node.js.
During college, I have achieved a significant amount of experience in C, and I also have some experience with Javascript and Node.js.
Additionally, during my contribution to stdlib, I have also worked on C, JavaScript, Node, and Julia and I have gotten a large amount of experience with the respective technologies.
I have a good idea now for how a package should be implemented and what is required for the development and implementation of the various API's and utility functions.
Also, whatever I do not understand, I am more than willing to learn and I will do my absolute best to output high quality code quickly and efficiently. Even while I was making the current contributions to stdlib, whenever I would run into any problems, I would try to debug it on my own first, search online on various sites, and if that didnt work, I would turn to the stdlib community, which is very helpful, and would get the required help and guidance.

Prior art

The work on this project has already been started. Many functions in math/base/special have already been implemented, and others are already working on optimizing it even further and adding new implementations. 649. This is very helpful because it provides new developers a foundation to already build upon rather than having to build a new project from scratch.

Commitment

As I currently have a full time job at Oracle,
I would like to work on the job as Part time: (175 Hours)
I plan to be give more than ~ 20 - 25 hrs/week during GSoC
I have no other commitments that would cause any issues with contributing to this project

Overall Plan

I have gone through the codebase and used the command node ./lib/node_modules/@stdlib/_tools/pkgs/toposort/bin/cli $PWD/lib/node_modules/@stdlib/math/base in order to perform a topological sort of the dep tree.

I have found that the following functions are missing C implementations. I have listed them along with their order (line number) in the dep tree.

cabs2f -> 10
cceilf -> 35
cflipsignf -> 80
heavisidef -> 102
minn -> 133
minabsn -> 134
minmaxn -> 135
minmaxabsn -> 136
minmaxabs -> 137
minmax -> 138
maxn -> 142
maxabsn -> 143
heaviside -> 161
bessely1 -> 233
sici -> 248
betainc -> 350
betaincinv -> 352

Additionally, I have also found the following packages that are missing implementations that I plan to implement (C, JS, benchmarks, examples, tests, docs, etc). These were not a part of the toposort output, so I still need to have an in-depth look at whether or not there are any pending dependencies. In that case, I will either move to resolve the dependency first, or in case there is an open PR already, I will implement another function.

betaincf
betaincinvf
cceilnf
rising-factorialf
roundsdf
sicif
exp10f
round2f
betaf
cotdf
cotf
tanf
truncbf
ceilnf
trunc2f
factoriallnf
cscf
sinf
ceil2f
log2f
  • Some functions will require consulting the appropriate reference implementations. I will identify implementations that are IEEE 754 compliant.

  • For functions that involve complex numbers, I will be referring to C99 implementation

  • These are some of the libraries that I will be considering:

  • I plan on finishing the implementations for all of these functions. Additionally, if I am able to finish the implementations for these functions before the end of GSoC period, I plan to pick up new functions for implementation.

Schedule

Assuming a 12 week schedule,

  • Community Bonding Period: During this period, I intend to implement functions that have not been implemented yet, or the C implementations for functions that already exist. Currently, I am planning to implement the following C implementations: cabs2f, cceilf, cflipsignf, heavisidef, minn, minabsn, and the complete implementations for following single precision functions: betaincinvf, betaincinvf, cceilnf, over the 3 week Community Bonding Period.

  • Week 1: I will be focusing on the C implementations of minmaxn and complete implementation of rising-factorialf, roundsdf functions. If any functions are pending from Community Bonding Period, I will also aim to complete them.

  • Week 2: During this week, will be working on completion of C implementations of minmaxabsn and complete implementation of sicif, exp10f functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 3: During this week, will be working on completion of C implementations of minmaxabs and complete implementation of round2f, betaf functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 4: During this week, will be working on completion of C implementations of minmax, maxn and complete implementation of cotdf functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 5: During this week, will be working on completion of C implementations of maxabsn and complete implementation of sinf, truncbf functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 6: (midterm) During this week, will be working on completion of C implementations of heaviside and complete implementation of tanf, ceilnf functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 7: During this week, will be working on completion of C implementations of bessily1 and complete implementation of factoriallnf, trunc2f functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 8: During this week, will be working on completion of C implementations of bessily1 and complete implementation of factoriallnf, trunc2f functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 9: During this week, will be working on completion of C implementations of sici, betainc and complete implementation of cscf, ceil2f functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 10: During this week, will be working on completion of C implementations of betaincinv and complete implementation of log2f functions. Additionally, if there are any functions pending from previous weeks, I will also aim to complete them.

  • Week 11: Will complete any backlog from previous weeks. If there is no backlog will work on implementation of other packages. Will check if there are any additional packages with missing C implementations, or missing single/double precision implementations

  • Week 12: Will complete any backlog from previous weeks. If there is no backlog will work on implementation of other packages. Will check if there are any additional packages with missing C implementations, or missing single/double precision implementations

  • Final Week: Will be wrapping up any pending tasks or functions, and along with that, also will be working on any additional things if required by the mentors

Notes:

  • The community bonding period is a 3 week period built into GSoC to help you get to know the project community and participate in project discussion. This is an opportunity for you to setup your local development environment, learn how the project's source control works, refine your project plan, read any necessary documentation, and otherwise prepare to execute on your project project proposal.
  • Usually, even week 1 deliverables include some code.
  • By week 6, you need enough done at this point for your mentor to evaluate your progress and pass you. Usually, you want to be a bit more than halfway done.
  • By week 11, you may want to "code freeze" and focus on completing any tests and/or documentation.
  • During the final week, you'll be submitting your project.

Related issues

No response

Checklist

  • I have read and understood the Code of Conduct.
  • I have read and understood the application materials found in this repository.
  • I understand that plagiarism will not be tolerated, and I have authored this application in my own words.
  • I have read and understood the patch requirement which is necessary for my application to be considered for acceptance.
  • I have read and understood the stdlib showcase requirement which is necessary for my application to be considered for acceptance.
  • The issue name begins with [RFC]: and succinctly describes your proposal.
  • I understand that, in order to apply to be a GSoC contributor, I must submit my final application to https://summerofcode.withgoogle.com/ before the submission deadline.
@sahil20021008 sahil20021008 added 2025 2025 GSoC proposal. rfc Project proposal. labels Mar 23, 2025
@sahil20021008
Copy link
Author

Does this seem fine?
Please let me know if any changes are required
@kgryte @Planeshifter @Pranavchiku

@sahil20021008 sahil20021008 changed the title [RFC]: Develop C implementationf for Base Special math functions [RFC]: Develop C implementations for Base Special math functions Mar 25, 2025
@kgryte
Copy link
Member

kgryte commented Apr 3, 2025

@sahil20021008 Thank you for opening this RFC. A few comments/questions:

  1. You list around 14 functions in your plan, which comes out to roughly 1 function per week. Some of those you list are fairly trivial. What is your expectation for how long a function will take to implement?
  2. How have you determined the priority order for the functions you intend to implement? How you performed, e.g., a topological sort of the dep tree?
  3. Some functions require determining appropriate reference implementations. How will you identify which reference implementations to follow? And what libraries will you consult?

@kgryte kgryte added the received feedback A proposal which has received feedback. label Apr 3, 2025
@sahil20021008
Copy link
Author

@kgryte , thanks for your review/feedback.

  1. I have expanded on the list of functions to implement. Current plan is to implement about 2-3 functions per week. I am not completely sure about how much time would be as I have raised 2 PRs uptil now. I expect I will be able to gain speed as I get more used to contributing to stdlib repo.
  2. I had used the make command: node ./lib/node_modules/@stdlib/_tools/pkgs/toposort/bin/cli $PWD/lib/node_modules/@stdlib/math/base. This was able to help me decide on the priority order for the C implementations, but this did not include the functions that haven't been implemented yet, so I still need to make look into those functions and analyse for any pending dependencies. In that case, I plan to either resolve the dependency, or in case of open PR, move on to implementation of another function, and pick this one later.
  3. I will utilize implementations that are IEEE 745 and C99 compliant. Some examples are Julia, Golang, Boost, Scipy, etc.

Please review when free and let me know if you have any further feedback for me.
Thanks

@sahil20021008
Copy link
Author

sahil20021008 commented Apr 5, 2025

@kgryte
I have also added the stdlib showcase and added a github link to it.
Please review

@kgryte
Copy link
Member

kgryte commented Apr 6, 2025

Looks good. Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2025 2025 GSoC proposal. received feedback A proposal which has received feedback. rfc Project proposal.
Projects
None yet
Development

No branches or pull requests

2 participants