Wednesday, August 31, 2011

R: Going faster than vectorization


Update: The by function of R can be used for the same task since data for me is stored in the same data.frame. I have tested that out later on in the post.

Recently I had to run though a large data.frame in R, selecting values from a given column based on an equality constraint on another column, in this format:

for(i in 1:length(values)) { 
  t <- my.var$row2[ my.var$row1 == value[i] ]; 

This is a fairly common operation and I had thought that beyond the vectorization I had done (borrowed term from MATLAB), R would take care of optimizations under-the-hood.

At this point, I thought how I would do it on a larger database and it struck me that perhaps I can do better than R if I manually index the data and find relevant intervals myself. How much faster can that be?

Thursday, August 25, 2011

Getting powerdot to work

Powerdot is a presentation package for LaTeX, much like beamer.

I recently got it up and running on my system and I thought I'll setup a quick guide for it:

Tuesday, August 23, 2011

Book Review: Half Asleep in Frog Pajamas

Half Asleep in Frog Pajamas
This is a book about a stock broker. Rather about two stock brokers, one current and one has-been; a she and a he broker. However, this is not a book about the Stock Market per se, neither is this a book about love, nor sleaze.

The book is written in a diary format, with time progressing linearly, with each entry marked with a day and time. The entire book, as advertised, is over in about the time-span of a long weekend.

Each entry in the diary begins off-topic and slowly careens into the old story line: sometimes in enlightening and sometimes in ridiculous ways. It probably reflects how a stock broker thinks when she is not thinking about the stock market. The book is sort of a drag in the beginning, until one gets to the evening of Friday and something of interest happens.

Monday, August 15, 2011

Gabriel's gift : A review

This has to be one of the most inspiring books I have read in a long, long time.

It starts with a magical touch, and a despairing look at the life of a broken family. And it goes uphill from there. There are moments where the book seems about to be taking a sinister turn, but instead it surprises the reader. A quite adorable tale indeed.

It is a very easy read, has a simple story told from the point of view of a precocious school-going teenager Gabriel. Kureishi managers to keep the narrative as well as the ideas extremely simple without losing any credibility at all. What we see in-front of us in the book is London with its motley populace, with stories of inhabitants intertwined and where opportunities seem to be hovering around every corner:
What a bright place London was, he (Gabriel) thought. Here anything could be achieved! You only had to wish high enough!
Opportunities waiting to be grasped by all but the hopelessly self-destructive. And Kureshi's London seems to have many of those, which somehow rings true with London we see today

It is amusing to see him trying to avoid vulgarity just like Dickens tried to keep the young readers in the dark about Phillip's exploits in London, but only in Garbiel's thoughts and words. He carefully avoids any detailed descriptions of Speedy's pose or what secret things happened in the bathroom while he drew his mother and her company or the indelicacy of bed's creaking while he was hidden under it. However, whatever we manage to see of London beyond Gabriel, it looks as colored as ever.

Wednesday, August 10, 2011

Humble Indie Bundle 3: A review

It was jolly good ride for the Humble Bundle 3, and it was far better and more exciting in the second half than the first one:
15 days of Hunble India Bundle 3

Sunday, August 7, 2011

The Rebel Angels: A review

It is not a very easy book to read. However, it is totally worth it. It reminded me of Salman Rushdie's Midnight's children, though magic realism in this book is much more subtle and integrated. The sequel of this book What's bred in the bone contains many more explicit supernatural elements than does this book. However, I like it all the more for it.

The pace of events never dies after the explosive and completely unwarranted introduction. The university atmosphere being built up feels construed in the beginning, but as one gets used to the eccentric characters and Gothic milieu of Spook university, a rich pasture from an imaginative mind emerges. The story is slow paced and borders on being a philosophical text. However, because of the setting of the story, it does not seem out of place. And the instances of philosophy are broken with patches of humor. Yes, the humor in most cases requires knowing some bits of Greek and Roman mythology and history, but the book does not go out of its way to make it hard. Actually, I would like to read the book once again just as I did Great Expectations in my school days, with annotations and helpful hints thrown along the way. The skill of Robertson Davies as a writer clearly shows through here.

This book is narrated via two different point of views, one of pastor Simon Darcourt and the other of Maria Magdalene Theotoky, a student pursuing a PhD in a field which can be vaguely related to medieval literature. They both have almost equal portions of the book dedicated to them with chapter names alternating between The new Aubrey and Second Paradise. The transitions are smooth and only at one point temporal interleaving comes into play, and that is during the climax.

Allusions to various other sources abound and the development of plot is intricate and subtle. The winning point of the book for me was the dry humor of Simon. The dry and cool manners of Arthur Cornish, the narcissist boasts of McVarish, the gypsy ways of Maria's mother and Maria's confounding attempts to distance herself, the crooked ways of Parlabane and the classical University settings and everything else too make it a memorable book.

This is a book about struggle to rid one of one's past and future, or one's fate. Also, entwined in it are love stories, from love of common gadje people to love of gypsies to love referred to as carnal knowledge to love which fringes on platonic and finally a kind which is nothing more than eternal friendship.

Overall, a very very enjoyable book. Highly recommended.


Tuesday, August 2, 2011

HumbleBundle 3: The first million

The road to the first million attained almost half-way though the bundle was wrought with events:
Humble Bundle 3: The first million