Anuga– hydro dynamic software

I was at scipy India 2012 conference in Mumbai over the weekend and got bored of juost following the lecture and tride to install this anuga hydro dynamics project on my fedora box. There was no direct rpm for fedora 17 and i had to build from source, and soon i find that there’s an import of ScientificIO python package* required to be downloaded.
Some more google searching and it turns out it is an old package of scipy,numpy and netcdf, but not bundled anymore therefore not available anymore. I had scipy and numpy installed and only need netcdf .
I found an rpm and got it installed, thanks to iit bombay’s ftp mirrors.

Now the only thing left for me to install anuga is to get the python imports replaced.. After trying to run python setup.py install a couple of times and replacing the imports manually, it was very very clear, it will be a pain to get it done manually. Puneet chaganti suggested i use sed. I have come across sed before but haven’t really used it but boy, after 10-15 mins of reading man files google searching for examples, it was straight forward.
All i had to do was go into that directory and run

find -print -name ./ *.py |xargs sed -i '/s/offensding text/replacement_text/g'.

Now i run python setup.py install and voila it is all done.. it works perfectly.great i can get back to trying out and playing around with anuga per se and it’s simulations.

* — It seems it is still available here

Money as a leaky abstraction

This made me think. Money after all is a level of abstraction up from barter system old civilizations used. As abstractions are wont to.(see Joel spolsky’s leaky abstraction post), it has it’s leakages and the question becomes what can be done about minimizing those leakages?.

“So long as men live together on earth and need means to deal with one another—their only substitute, if they abandon money, is the muzzle of a gun.” | Atlas Shrugged

There’s one blog post worth of ideas exploring,(Analogous to this one) though i don’t have the time or skill at the moment, will attempt it when i am more of my masochistic self. :-)

Well, using money as a sustitute for the barter systetm has it’s own problems, to begin with, it endows an inordinate amount of power to the bank employees, who actually are responsible for the execution of processes involved in the abstraction. A case in point, toda’ys experience at HDFC bank, waiting for more than an hour all to just withdraw only 10,000 instead of the 30K i wanted to withdraw, all because i have my cheque book, exhausted, debit and credit card blocked. am not trying to single out hdfc it just happens so that i used it right now.

The point being the employees are so bound by rules and trained so strictly that they dare not think on their own,except of course trying to sell me some investment oppurtunity.

Indian cricket

Now to the indian cricket team after taking some beating 0-8 overseas and 1-2 at home against england.

Clearly the team is going through some major adjustment period, unfortunately given how these things work the selectors are not likely to announce major shocking changes, but there will be some changes, that allow them to save face in the face of the media, but unfortunately it is not likely to have any long-term thinking or impact on the team.

The team is likely to play on like this,(they may manage to pull out a win in nagpur, but don’t expect a revenge on australia when touring them or for that matter good results(i mean like the draws back in 2003) when touring SA. Overall, sachin will retire at some point over the next year or so, Indians will stay poor travellers for the next 3-4 years or so.

As it turns out the star bowler Harbhajan singh in that match is not in the current team, he made an appearance in the previous match but did not justify his selection.

Can’t ever remember watching ashwin bowl in a test match but reading all the commentary seems to me like, he’s having trouble getting used to the overall slower tempoof test cricket.

i honestly think at this point there is room for changes in the selection method itself. As far as i have followed it seems very little organized or planned, i.e: the selectors committee has been the most flexible, most built to absorb/mitigate the pressure from media(aka perceived public emotions), most changing in accordance with the tune of the media. It is high time we bring in some professionalism into the selection process,a regular selection of 16-18 probable players with the captain + coach + team management choosing the final 14 for the series would be a good idea. While i wouldn’t care to defend the actual details of this idea, i would defend the spirit. What i really am arguing for is a transparency in the captain+ team management’s effect on the actual selection process.

We do know, the captain has some influence and say in the selection process, but it is all a mess and it is not clear who he chooses. By limiting the power of selector’s to probables and leaving the rest of the selection to the captain, we give more power to the team management and add transparency among players(and public) in how the team management chooses.

I know the effect of public getting visibility to this set of decisions is a confound factor if you think of this as an experiment, but my main assertion is that little more clarity/visibility of team management’s decision-making among players is worth a risking it.

As for the captain, i think we should go with a different captain for T20Is from the Test and ODI captaincies. I think the tempo differences is too high for someone to adapt, infact it is part of the same problem i mentioned with Ashwin, trying too much or too little. basically when you are trying to make decisions at different tempos, you need to have some refractory period between them. I can’t judge, but from seeing some of the criticism on Dhoni’s captaincy, it seems like he has put test captaincy into procedural thinking mode and that seems to be costing him.

Disclaimer: Ok now that i have got the stance making out of the way, now for criticizing and pontificating, questioning the retirement timing of Dravid and Lakshman or the persistence of Sachin is not my expertise or target, perhaps because i rarely watch cricket and much rarely play it so don’t pretend to be able to judge the players’ abilities or variations in them. I mean sure part of being Indian means following cricket and i went through crazy watching every match phase for about asemester (beginning around that epic VVS Lakshman and Dravid stand at the kolkata stadium, i remember getting bored of watching the match and drifting in and out back then but being there for that epic partnership). And completely gave up on being a die-hard india fan around the time Ricky ponting scored a 160 in the 2003 world cup final. Since then, i have been an outside the fringes watcher, following the world cup scores, every hour or so. Following match results if the series seem interesting(top teams)etc .

Ok having had all that disclaimer out, now i can go on to what i set out to do, speculate freely, correlate cherry-pickingly as i please and cite rarely.

P.S: I suppose it is a little late to post this, now with the BCCI’s announcement.But what the hell, i still swear by my suggestions.

Modular decomposition tree

This is an old problem that has been bugging me. i came across it back 2 years ago, when i was an active member of the python-graph package dev group. i failed at comprehending the papers that christian sent me nad gave up perhaps too soon. But the concept of splitting a graph into modules and forming the modular decomposition tree has always been at the back of my mind. so i used to think about it on and off during free times.
Anyway, yesterday’s trip to bangalore to take CAT, was a good time for me to consolidate.
And i came up with the matrix representation version for teh problem.
take the incidence matrix,say In(nxn, with n being the number of nodes in the graph).*

Now a module is a smaller square matrix within this matrix, such that,
1. the elements of columns of the larger matrix(except the elements of the smaller matrix) all match column-wise.
2. the elements of rows of the larger matrix(again, except those of the smaller matrix) all match row-wise.

Ok, question again, those two interpretations from graph to matrix don’t translate well at all.
What exactly is a row or column in the incidence matrix? it is a list of which vertexes can be reached in one step.
What is the definition of a module? a subgraph that is(any of whose vertices) indistinguishable from any of the other vertices outside the subgraph, if it is replaced with a single vertex. what does it mean? it means if a vertex in the module is connected(adjacent) to a set X of vertices outside the subgraph then all the vertices in the module are connected(adjacent) to the exact same set X of vertices outside the subgraph.

Now time to translate that to the incidence matrix. Replacing a module by a vertex is the equivalent of picking any nxn sub matrix out of the given Incidence Matrix(NxN), ORing the rows together, and the columns together.

What does the operation of checking if it’s a module or not translate to in the Incidence matrix? It translates to comparing the row and column of a given matrix elelement and making sure they are the same.

So what the hell is a MDT(modular decomposition tree)?? It is a hierarchy of all the modules in a given graph. from the biggest to the smallest.

The question becomes how can you find the modules. Then you start all the operations you can do on a matrix,without changing it. Exchanging rows and columns. adding two rows and replacing one of them with the result etc. Add to this the matrix is binary it becomes exciting. imagine it can be treated as a byte/bit-sequence.

* — I know i am assuming graphs on a plane and ignoring hyper-graphs, but you can just increase the dimension of the matrix and get a hyper-graph. the challenge will be while writing out the algorithm, to stay aware of the tricks that work only on a 2-dimensional matrix.