Trac, Github, and other snippets …

Okay the last blog was more of how I got introduced to the program and more of like a story. During the past week we had few targets one was this blog, second the development workflow, and third discussing the structure of the code. First the blog was set.

Now coming to the development workflow. We had these options
Clone the Sage source from github onto local system, then run the make. Once this was done we had the local system which had Sage in it. Now whenever I edited the code I could just do a sage -b (which builds Sage with the changes made) and in the same way test the code by using sage -t. And once the tests passed I could send a pull request against my mentor’s branch on github. This was the thing we finally settled down with.

The other was to create a ticket on the Trac server and then push the code frequently onto the Ticket created. But I was a bit comfortable with github so choose that over this. However it was made sure that after sufficient code has been pushed onto github we can create intermediate tickets on Sage Trac Server which would make review as well as maintenance easy.

The next target was to analyse the various knot software already present. So I started with Seifert Matrix Implementation which would take braid word representation as input. Here given the dimension we wanted to edit the elements of the matrix. So we initialized a zero matrix and would be working on editing the elements according to the algorithm, the parts of which would include components, invariants as outputs . This eventually forms the first few weeks of work during the coding period. Here’s the snippet which we can use in Sage to create an empty matrix and further edit the elements. Just had some loops and conditionals in there.

sage: A = matrix(QQ, 2, 3)
sage: A
[0 0 0]
[0 0 0]
sage: A[1,2] = 1
sage: A
[0 0 0]
[0 0 1]
sage: for i in range(0,1):
….: for j in range(0,2):
….: if(A[i,j]==0):
….: A[i,j] = 5*i + 8*j
….:
sage: A
[0 8 0]
[0 0 1]

During the later parts of the week, I started to look through Spherogram which had a Link class and Rknots package which mostly works on taking 3D inputs and working on them to calculate various results related to knot theory.

In the coming weeks the focus would be on further strengthening the ideas used in Spherogram, however the coding design of Spherogram is a bit of concern to directly import it into Sage as it uses classes for internal representation. I guess we could work on this and as well structure the data structure part and hopefully come to some constructive conclusion on this issue.
On similar par lines the code in Rknots is pretty much extensive and I have started to read code in R language. Till now it has been fascinating, now I need to dig deeper to understand it in greater detail. As as of now, methods which would get mostly integrated look like PCA projection and getcoordinates methods. Thanks for reading through.

Advertisements

GSoC 2014 with Sage

This seems to a dream semester running for me. I have been lucky enough to code for Sage this summer on the topic of Knot Theory under the Google Summer of Code program. It all started in my first semester of my college when I heard about the program but I didnt know how to proceed or what to do next. It was the fourth semester and a Humanities class which helped me made my first contribution to open source. I was having a talk with my senior, and it got to the point of version control and then it eventually led to contribution to FOSS. The next few days were exciting and amazing as we were able to figure out how things work. I got help on how to work on a huge code base and fix some patches. My first patch was for Sympy, which had some work on expanding the rotation operator when applied on a ket in the area of Quantum Physics.At the same time I was looking around for some quantum physics topics especially in the area of Quantum Computation to work upon. Switch to fifth semester, (the first contribution was in fourth), I had gained a considerable amount of knowledge in Quantum Computation and was looking for more insight. I sent out a mail to a senior asking him if there was some intersection with abstract mathematical topics like Group Theory, Topology and Quantum Computation, at the same time I had a discussion on reddit about the same. He gave me a list of topics and suggested me to read through the work of few  leading researchers. I started to search and arrived at the concept of Topological Quantum Computation (In short following is my understanding, the concept of braiding anyons would give rise to a phase angle, which can  be used as Quantum Gates, these particles can also be used to compute the error in computation , they send in the test particles at a particular point in time to braid around the particles whose state is to be measured, the case with quantum systems is one cannot measure the system at any point in time as it would destroy the entire computing process, there is also the algorithmic extension where in the knot invariants can be found out, in sense the algorithmic time in quantum realm (quantum algorithms) is more faster when compared to the classical one). Now the concept of braiding was taking shape as I started to read about it which led to knot theory. Closure of braids led to links and links are generalization of knots.Switch to sixth semester, the month was February and the organization lists were out, and I was scanning through the ideas as well pitching them. I always wanted to mix coding with what I learnt, and then came across the idea of Knot Theory on Sage. I started to work on the ideas I learnt and started looking around the already present implementations to get a better understanding of what I could do. In the mean time in order to get familiar with the development process, I started to set out few easy bugs. I managed to fix two and at the same time started to discuss the idea with my mentor. I started to get a structure and we started to discuss the details at depth. I guess I made a decent proposal with the ideas that I felt I could implement, not before there a lot of discussion of documentation and implementation style. We had concerns with how the input given by the user would be processed, finally with great help from my mentor we were able to tackle this issue. Once this was set I was onto setting up a small demo version of code, I wrote some code integrated it into Sage. They were a lot many edits to the initial draft of the proposal which finally I think took a good shape. An initial draft of the proposal in the review phase [1]. There were also consultations with the probable front end developer on how the communication could take place between the front-end and the back-end. In a quick time the deadline approached, at the same time I became a bit busy with my preparations for the exams and had to travel before that on some personal work. So my activity had gone a bit low after the proposal was posted. After I was done with the exams I started to work back on the idea and was waiting anxiously for the results. They were some great proposals on the front end and on other topics as well. Finally 21st arrived, I was a bit perplexed with the way things were shaping out on that day, but finally at 12:30 AM (2 minutes early to be precise) in the morning there was relief as I received a mail confirming my acceptance as a student for GSoC. I would be working under the mentor-ship of Miguel Marco with whom I had the entire discussion. I would like to thank Miguel and the entire Sage community for having accepted me as a student and giving me a chance to work on this great project. Finally but not the least I would like to thank my parents Jyothi Prakash and Surya Prakash for having supported me and allowed me to pursue my interests. Many thanks to Sruthi, Srikanth and Praveen, for having inspired me and guided me in the right direction. For the next few weeks it is the community bonding period and we are working on setting up the repo (trac vs github) for the project, setting this blog up which would get technical as time progresses with the implementation details and other encounters which I come across while we work on the project. Once the environment is set we would like to discuss the structure of various implementations. So my next post would be on how I prepare before the coding period starts. Thanks for reading through.

[1]. https://github.com/amitjamadagni/Knots/wiki/Knot-theory-implementation