GSoC Coding period is about to start next week.
The past week I was focused on completing the NTheory Ruby wrappers, in order to complete my promised workload for the pre-coding time.
The main lessons learnt from this week’s work was handling conversions between Ruby and C types. This proved to be a quite easy task, with the Ruby C API.
The Definitive Guide to Ruby’s C API covers this in detail.
Then I had to figure out how to let SymEngine Integers to be implicitly convertible into Ruby numeric types. This proved tricky for me to get around as I wasn’t aware that it could be done in the actual Ruby code, without having to use the Ruby C API. The implicit conversion to Ruby numeric types was quite easy.
As shown in the gist above, I just had to declare the class in the lib folder with the necessary conversion method.
With this part done, several number theory functions can now be called upon SymEngine Integers. Those functions are:
- Next Prime
- Fibonacci Number
- Lucas Number
Now that this part is done, the next step would be to start coding from next Monday. From my proposed plan, the first two weeks would be for wrapping Complex Numbers and Floating Point Numbers for Ruby.
See you after the first week.