Friday, 15 August 2014

The deadlines ringing do remind that 3 months have flown past in a jiffy. Time to bid sayonara! Good times seem to roll by too soon, always; sad thing! Nevertheless it has been a great experience under a brilliant mentoring. The post has come up much later the previous one. Things have taken shape since then.

1. Ellipsoidal Harmonics:
 Ellipsoidal harmonic functions, the first kind; also known as Lames functions have been implemented in Cython and had been integrated with ufuncs.
 Ellipsoidal Harmonic function of the second kind and the calculation normalization constant for Lames function were implemented as .pyx files due to the involvement of global variables. The calculation of normalization constant was implemented in 2 different ways, using integration and using recurrence. Though recurrence seemed to be the more basic and faster way of implementation, the numerical stability wasn't that good; so we adopted integration.
The process involved many new things to me, like the integration of awesome LAPACK library, the speed and awesomeness of Cython etc!
The pull request is here: https://github.com/scipy/scipy/pull/3811
2. Hypergeometric functions:
The present implementation of hypergeometric functions is buggy. For real values of x, C implementation of the function from Cephes library has few errors while the FORTRAN implementation for complex values of x suffers with errors for much wider domain. There has been an attempt to re-implement the function in Cython and make it less ridden with errors. Though the shortage of time denied a bug-free implementation a few bugs have been removed successfully.
The implementation so far has been posted here

I would yet again stress on the fact that the flipping of bits this summer has been of great fun and well as a great skill and knowledge booster. Never was my summer so productive!

Signing off with loads of great memories and experiences
Janani

Wednesday, 25 June 2014

With those mid-sem bells chiming, it is time for another update.
The following checkpoints have been reached:

1. The implementation of ellipsoidal harmonic function (also known as Lame's function): The first kind.
The following is the link to the pull request:
https://github.com/scipy/scipy/pull/3753
The implementation is in Cython and calls LAPACK subroutine. It is based on the python implementation by Knepley and Bardhan given here
Further the absence of Lame's function implementation by any many other libraries there is a challenge in preparation of an extensive test-suite. At present the output of the function for certain range of inputs is tested. The immediate next plan is to try improving the test-suite.
This will be followed by the implementation of Ellipsoidal harmonic function: The second kind.


2. Before this the spherical harmonic functions were improved by reimplementing them in Cython rather than python thus improving the speed.
The details having been elaborately touched in the previous post, are omitted here, saving people from the boredom due to redundancy. The pull request can be accessed from https://github.com/scipy/scipy/pull/3692

Thanks to the constant support of my brilliant mentors Pauli, Ralf and Stefan, (and I suppose, few miracles!) the progress is as per schedule. Hoping that this pace will be maintained or even better, quickened; post mid-sem evaluation!

Signing off till next time,
Janani

Thursday, 5 June 2014

2 weeks over! That was fast..
And I have sent my pull request finishing the first of 4 sub-parts of my project.
The link to the pull request is https://github.com/scipy/scipy/pull/3692.
Here the function to implement spherical harmonics has been rewritten in Cython. It uses lpmv fortran sub-routine (with the help of the existing wrapper function pmv_wrap) to calculate associated Legendre Function.
Initially the function to calculate spherical harmonics was written in python which called lpmn function to calculate the associated Legendre function. Lpmn function in turn uses lpmn fortran routine to calculate the function. The routine iteratively evaluates associated Legendre function for all orders and degrees m and n. While the routine lpmv avoids the iteration by using recursion.
The usage of a different routine and rewriting the code in cython has given a huge leap in the speed of the function which is shown in a simple benchmark performed by Pauli,
Before:
 In [4]: %timeit sph_harm(50, 50, 0.5, 0.9)
10000 loops, best of 3:
81.3 µs per loop
 In [5]: x = np.linspace(0, 1, 2000)
 In [6]: %timeit sph_harm(50, 50, 0.5, x)
 10 loops, best of 3:
127 ms per loop

After:
 In [2]: %timeit sph_harm(50, 50, 0.5, 0.9)
100000 loops, best of 3:
 4.52 µs per loop
 In [3]: x = np.linspace(0, 1, 2000)
In [4]: %timeit sph_harm(50, 50, 0.5, x)
1000 loops, best of 3: 1.87 ms per loop

Now the next part of the project is to implement the ellipsoidal harmonic functions. It is kind of challenging as they are complex and they havent been implemented much. My next 2-3 weeks are dedicated to the implementation of the both kinds of ellipsoidal functions, thus meeting my mid sem deadline.

Thursday, 22 May 2014

Hey all,
The calendar shows the day to be the 23rd of May and so officially we have slided into the first week of coding, well.. we are towards the end of first week!!

My immediate target for the week is to implement the spherical harmonic function with the existing 'lpmv' function rather than the 'lpmn' because the latter at present calculates the associated Legendre polynomial iteratively for all degrees and orders less then m and n. We aim to remove the redundancy by adopting lpmv instead of lpmn.
And also the aim is to write the entire sph_harmonic function in cython to improve the speed and accuracy.

Tuesday, 29 April 2014

Woo-hoo! So GSoC-2014 it is then! The night of the 21st was memorable; with a friend of mine, banging on my door, trying to wake me up from my forced-sleep. Before that story, a quick tip from me. Sleep is the best rescuer when one is anxious. When anxious, nervous; simply sleep. :P
So yeah! she bangs on my door till so hard that I feel that the sky just fell down and then when I open the door she barges in, so very excited; and breaks in the great news. My bestie surprises me with a big yummy dairy milk silk in the middle of the night. Haha.. So sweet a moment it was. Those phone calls and messages and all.. Love you all people!
So this is how I came to know of the results.
Next morning I opened my formal acceptance mail, and as and when the initial super-excitement subsided I started working on the other formal requirements. And today, on the 29th of April I am done with all the formalities. Eagerly waiting for my semester end exams to get over and the happening summer to kick start!!!

Monday, 17 March 2014

Hi,
This is Janani, a happy-go-lucky girl with beautiful little dreams! Here I shall be posting randomly the things that affect me, touch me or just amuse me. At present the event that fueled the creation of this page is GSoC -2014 which makes it mandatory for the prospective students to have a blog. After initial hesitations, now as I write this, I am grateful for this compulsory requisite.

Now, time to do justice to the main purpose of this blog. GSoC i.e. Google Summer of Code is an exemplary effort taken by Google every year, to expose young and enthusiastic students to the world of open source coding under the priceless guidance of experienced mentors who actively contribute to the mentoring organization.

Yeah, so I am one of the thousands of students who dream to have this amazing experience. I am really eager to spend the summers in association with SciPy.  Do have a look at my humble attempt here and feel free to give your opinions.
Let us wait till the 21th of April to find out if the central purpose of the blog thrives. Thanks for reading till the end! Hope to have you back here soon!

Signing off
Janani