Nadodiyin Pulambal

A Wanderer Gripes

Partial fields of words in MIX

Posted by kovaiputhalvan on October 11, 2009

Section 1.3.1, pp 126 – 127, TAOCP vol 1, 3rd Ed.

… Each field specification (L:R) is actually represented inside the machine by the single number 8L + R; notice that the number fits easily in one byte.

What’s with the 8L + R? Most people would’ve figured this out in about 3 seconds, but not me :)

Each byte in MIX is 6 bits long. Each word is 5 bytes long, and has a sign bit. MIX lets you work on part of each word – hence the (L:R) notation to specify which part of the word you want to work with. (0:5) refers to the entire word, (0:0) the sign bit, (1:5) the “unsigned” part of the word, (5:5) the LSB, and so on.

Which gives us 0 \le L \le 5, 0 \le R \le 5. Each of L and R then require 3 bits to represent – and can fit nicely side by side in a 6-bit MIX byte. The 8L + R packs L and R into a MIX byte – shift L by 3 bits, and slap on R into the remaining 3 bits. Unpacking them is just as easy.

That’s that with the 8L + R.

Posted in TAOCP | Tagged: | Leave a Comment »

Next Post

Posted by kovaiputhalvan on September 13, 2009

The last week has been a little chaotic, thanks to my son’s being unwell. I’m at work, trying to make up for time lost last week. Which by itself isn’t so bad – in the couple of hours that I’ve been here pre-lunch, I’ve managed to get a lot of work done, more than what I got done last week. Which is great :) While I’m no great fan of working on weekends, I must admit that my experience today has been refreshing.

Saw Kaminey a couple of weeks ago. Amazing movie. It’s almost like a Tarantino flick, except that there’s a happy ending. Great acting from both Shahid and PC. The music is outstanding, too. I’m currently listening to the Dan-ta-Dan song, and Go Charlie Go, in a loop. Just can’t get them out of my head. Junior loves Dan-ta-Dan, too. Starts dancing the moment he hears opening sax notes. I never thought I’d live to see the day when I’d say a Hindi movie was worth watching – but in my short lifetime so far, I’ve come across at least two movies that merit this compliment – Johnny Gaddar and Kaminey. There are probably more, but I don’t remember any now.

Discovered Brainfuck last week. Promptly wrote up a Brainfuck interpreter. Would /love/ to write a Brainfuck compiler, but I need to decide if this is something I want to do now, or during a vacation sometime. Since I haven’t written it up yet, it’s going to be the latter. There’s a shitload of work (at work, of course) that needs doing as well.

JV is still in Manchester. You lucky bleep, you. If you’re reading this, lemme know when you’re going to be back in the city of Bongs. And don’t miss Kaminey.

I’m off to the coffee machine. And then back to work!

Posted in Not Worth Reading | Leave a Comment »

Posted by kovaiputhalvan on July 26, 2009

Ages ago, when I was young, the primary channel that delivered music to most people’s ears was the radio. People who could afford it had a two-in-one – a radio which also had a tape recorder. Households for which affordability had not been a problem in a while also owned the two-in-one’s grandfather, a gramophone. Electric, if they were nouveau riche, or a hand-cranked HMV with the sawn-off trumpet if they were old money. Whatever else they did (or did not) have, every household had a radio. TV wasn’t such a big deal yet – only a few households had one. Black and White, at that. More often than not, it would be an huge wooden box with a glass oval popping out of its front like the eyeball of an octopus. TV was strictly for entertainment. Oliyum Oliyum on Fridays, Charlie Chaplin on weekends, and Johnny Sokko and his Flying Robot on – I forget – was it Wednesday evenings? The Radio, however, was much more than a box that played music. It was a lifeline. People adjusted their watches to “radio time”, depended on it for the morning news (seythigal vasippathu – Saroj Narayan Swami), and timed their schedules to the signature tune of the programme that was being broadcast. In most music-loving TamBram households, dinner would be an early affair, so that the music lovers could congregate around the radio by 9, right in time for their evening dose of classical music. If it was a National Programme of Music, which would be beamed all the way from Delhi, replete with Hindi announcers (and English ones) indulging in the wholesale massacre of Southern names – the entire household stayed up late, as long as the broadcast lasted. This was a special occasion, when the radio would bring an entire hour or two’s worth of kachheri to its audience, as compared to the piecemeal half-hour and one-hour broadcasts earlier in the week. No wonder then, that I grew up listening to DKP, DKJ, M. D. Ramanathan, Mani Krishnaswamy, MLV, T. N. Seshagopalan, Mangalampalli Balamurali Krishna, and other golden voices. I was too young to appreciate their music, however.

The radio in our household was a compact little Philips, shiny in its black and grey plastic casing, powered by three fat 1.5V batteries. It was, the embossing on its back announced, Tropicalized. It also had a tiny unreachable switch which would toggle between MW and SW. I had no idea what they meant. Often times, I had tried switching the radio to SW, only to hear the hiss of white noise. I assumed that SW was just another way of turning the radio off. One late evening – I don’t remember what time of the year it was – I was bored. I must have been all of ten years old. We were living in a small town called Udumalpet, about 80KM from Coimbatore. My father was late from work that day. As was usual, I postponed touching my homework until he was in. My brother was playing with the neighbouring kids, who were closer to his age than mine. My mother was, I think, chatting with her friend next door. TV was a big deal now. We had no less than two channels to choose from – Doordarshan, and – hold your breath – Rupavahini, that amazing entertainer from our Island neighbours down South. Udumalpet was so deep in the backwoods that our TV antennas had to be hoisted to a height of 40 feet, no less, to receive anything not remotely resembling snow. That blessed day, however, we were experiencing a power cut – which was why the TV wasn’t on. Emboldened by the late arrival of my father, I mustered up enough courage to pick up the radio and sit down with it on the doorstep. I turned it on, and listened to it whiste, hum and hiss as my thumb played with the tuner dial. This kept me entertained for about fifteen minutes. Idly, I found the unreachable magic switch, and selected SW. It was fun – the whistles sounded different, lasted longer, and there was a whole new variety of sounds that I’d never heard before. And then – I heard a human voice. “This is Radio Moscow”, it announced. “You’re listening to Moscow Mailbag”. I was struck dumb.

For me, that was truly a life-changing moment. In many ways. I’ll save the others for another day, and talk now about just one. Radio Moscow was soon followed by the Voice of America, Radio Australia, and many, many other stations. The one that stayed with me for long after, was The World Service of the BBC. It was on the World Service that I discovered the existence of Music of Other Kinds. Dave Lee Travis brought me pop and rock, I wrote to The Jolly Good Show every other month on an aerogramme with a stylized swan franking worth a precious Rs. 5, hoping to get a T-Shirt, but never did. I didn’t mind too much – getting to listen to good music was in itself a treat. Concert Hall, and later, Edward Greenfield and his eponymous collection, made me fall in love with classical music of a different kind. Haydn, Beethoven, Mozart, Ravel, Stravinsky, Bach, Wagner, Liszt, Mendlssohn, Handel, Chopin, and I forget who else. Greenfield it was who first introduced me to the magic that only Vladimir Ashkenazy can make with the Piano. This music was hard to get, and I savoured every moment of it that I could wring out of that black-and-grey box. A few years later, my father brought home a two-in-one. This was a godsend (I wasn’t an atheist then) – as long as I could wangle blank tapes from my dad, I was able to record the precious half-hour or one-hour long slots that the Beeb dedicated to classical music on its World Service. Tapes were so scarce that I would erase the pieces that I didn’t like, and record new ones over them. My father and I clashed over the use of the radio. Often times, Concert Hall would happen at the same time as a National Programme. Thus started my lifelong love affair with classical music of the Western kind. I hoarded my tapes, wouldn’t lend them to anybody, even if they asked nicely – for fear that they would treat my tapes carelessly. What was hard to get, stayed hard to get.

That was then. With the advent of the internet, music has become more or less cheap. One can find anything one wants, if one knows where to look. One such treasure trove of music was hosted by someone I’ll call Tengo, who dedicated it to his dearest Chaliga. I stumbled upon this storehouse of great pieces when I was studying in the Institute with the Tree Lined Avenues. There, I came across a piece by a composer I had never heard of – it was the Danza del Molinero, from Manuel de Falla’s El Sombrero de tres picos. It, not to put too fine a point on it, blew my mind. I scoured the net, scoured all the music stores I knew – but I couldn’t find any music by Manuel de Falla. It took me a couple of years to lay my hands on enough music by Falla, and the hunt reminded me of my younger days spent hunched over a black and grey box, straining my ears to listen to music that would periodically be overwhelmed by howls, whistles and hisses from the ether.

Last week, I got a faster broadband plan. One that lets me watch Youtube without having to buffer it for ages. I stumbled upon this: which was what put me on that train down memory lane. If you have the time (and the bandwidth – in this case, the product of the two quantities is /not/ a constant!), gentle reader, click on that button, and treat yourself to an amazing rendition of The Miller’s Dance.

Posted in Music | Leave a Comment »

Pointed and dull?

Posted by kovaiputhalvan on June 1, 2009

FTIB

Posted in Humour | Leave a Comment »

Posted by kovaiputhalvan on April 9, 2009

In an earlier post (written during an earlier life), I made mention of my boss’s boss’s boss, a big man in every sense of the term.

I was talking to him over the ether the other day. He mentioned that he’d had some time to kill, and he’d killed a part of it learning Python. I was impressed beyond words. Here was a man who had hardly had time to sleep, and when time was available, he used it wisely. Lest you form an adverse opinion of his capabilities, let me state that he earned his Ph.D in theoretical computer science from TIFR, Bombay. He’s achieved much, much more than that – but that is a story best saved for another day.

Contrast him with yours truly – younger, lazier, barely scraped through a Master’s degree and ran away from doing a Ph.D. Ran away from the subject of my Master’s, ran away to something I feel more comfortable with. All through my life, I’ve lived with the guilt that I was never a good student, never made good use of my time at school, college, or at the Institute with Tree Lined Avenues. Every time I get a few days off, I vow to read through and complete at least one chapter from one or more of the following books, depending on my mood at the time:

[1] Challenge and Thrill of Pre-College Mathematics, C. R. Pranesachar et al, New Age International Publishers
[2] Analysis-I, Terence Tao, Texts and Readings in Mathematics, 2006.
[3] Linear Algebra, Hoffman, Kunze, Prentice-Hall, 1971.
[4] A Survey of Modern Algebra, Birkhoff, MacLane, Universities Press.
[5] Computer Architecture: A Quantitative Approach. Hennessy, Patterson Morgan Kaufman, 3rd Ed.
[6] Structure and Interpretation of Computer Programs, Sussman, Sussman, Abelson, The MIT Press, 2nd Ed, 1996.
[7] The Art of Computer Programming, Volumes 1-3, Donald E. Knuth, Prentice-Hall.
[8] Algebraic Codes for Data Transmission, Richard E. Blahut, Cambridge University Press, 2003.
[9] Elementary Probability and Stochastic Processes, Kai-Lai Chung, Springer Verlag, 1977
[10] An Introduction to Statistical Signal Processing, Gray, Davisson.
[11] The Design and Implementation of the FreeBSD Operating System, Marshall Kirk McKusick, Wiley.

I’m not quite sure as to /why/ I do this – in part, because I think I’m now in a position to understand and appreciate the contents of these books better, and perhaps partly in atonement for my wasted youth.

The list is truly longer – I’ve restricted it to what is usually uppermost on my mind. Needless to say, I haven’t made much progress (if at all) with /any/ of the items in the list. Consider [6], for instance. I discovered SICP about two years ago, and was moved to tears by the beauty of Scheme. I was so moved that I started writing my own scheme interpreter. The day I started to write it, I made it parse numerical expressions – it would easily understand that (+ 2 3) evaluated to 5. It also understood things like (define pi 3.14159). The next day, I /almost/ made it understand what (define (sum x y) (+ x y)) meant. I then gave up, and haven’t looked at it since.

No wonder then, that I was depressed after yesterday’s chat with the Big Man.

Came today, and I was idly leafing through the pages of the little Green Book [1], when a problem caught my eye:

    * Problem: Show that 1 + 2!2 + 3!3 + ... + n!n = (n + 1)! - 1

    First thought:	WTF is this? Oh, OK.

    Second:		Too tough, where's the answer section? Oh crap, it
			doesn't have the answer to /this/ problem.

    Third:		Hey, I could use induction!

    Fourth:		Oh wait a sec. If I induct blindly, I'm not really
    understanding the problem. Let's see now... n!n can be written as
    (n + 1)! - n!.  That's it!  I just rewrite the left-hand side as
    sum_{k \in (1, ... ,n)}((k + 1)! - k!) and happily watch successive terms
    knock each other out, except for the second and the last, which are -1
    and (n + 1)! :

    1!1 = 2! - 1!
    2!2 = 3! - 2!
       ...
    n!n = (n + 1)!	- n!

I felt happy, but the happiness was as short lived as the fizz in champagne from yesterday’s bottle. The book was meant for kids in the 9th and 10th standards. Did I even have a brain anymore? That apart – a good problem solver (dare I say mathematician?) would display none of the trepidation of the second and third steps. [S]he would probably jump straight to step four, after optionally lingering at step 1. I hadn’t had enough humiliation for the day, so my eye proceeded to catch another problem:

    * Problem: Prove that in any given party, the number of people who have
    shaken an odd number of hands is always even.

    First thought:	Damn. I've seen this problem before... where? I've
			forgotten how to do this, damn it.

    Second:		No, you don't /remember/ how to crack problems, you
			effing /understand/ the problem and solve it. Idiot.

    Third:		Let's see now... why would this number be even?
    Hmm... let N_h be the total number of people who have shaken hands, N_e and
    N_o be the number of people who've shaken an even and odd number of hands,
    respectively.

    N_e is obviously even; so for N_o to be even, N_h has to be even. Now why
    would the total number of people shaking hands be even?  OK, here's how -
    each handshake involves two people, so the total number of people shaking
    hands is /necessarily/ even. Bingo. Sigh...

    Fourth:		Damn. It was one of those Russian books. Oh wait... the
    guy who wrote it had a funny name. It was a funny name even for a Russian.
    He has a twin brother but they didn't collaborate on this book. One of the
    their names is that of some ancient Jewish Rabbi. Arrghh...  The Brothers
    Yaglom. Akiva and Isaak. (True enough, the book I was looking for was "The
    USSR Olympiad Problem Book", Shklarsky, Chentzov and Yaglom, Dover
    Publications. And no, I haven't gotten beyond the first page.)

It looks like the fear of mathematics that was instilled into me during my schooldays is yet to take its leave. Not a very happy state of affairs, I might add. Someday, I might just be cured of this condition. When, I do not yet know.

Posted in Not Worth Reading | Leave a Comment »

Posted by kovaiputhalvan on March 1, 2009

Radio Indigo plays Nickelback fairly often these days – notably, Rockstar and Gotta be Somebody. This inspired me to get hold of some of their music, and that forms the bulk of my playlist these days.

I need to go get the car stereo fixed. The CD player is broken, complains of errors in any CD that I care to shove into its mouth. It’s been this way for some time now. It hasn’t hurt me much, thanks to the radio being permanently tuned to either Radio Indigo or Amritavarshini. However, there are traffic-jammed days when I find myself wishing for some soothing Led Zep when all the radio has to offer is Lady Gag-ga or some such. Then again, in these times of economic recession, one finds oneself thinking twice or more about every small expense. My list of things that I should buy (sometime before I die) has now attained mammoth proportions, and is growing at an alarming rate. Thanks to someone’s generosity, one item (actually two) has been struck off the list – I am now the proud possessor of the complete Trionfi tryptych. Ha!

I’ve just begun listening to Catulli Carmina, with a translation of the lyrics at hand – it’s been good going so far.

More later. Soon.

Posted in Not Worth Reading | Leave a Comment »

Posted by kovaiputhalvan on February 14, 2009

Been a while.

Went on my first roadtrip, strained my shoulders by driving 400KM nonstop, half of it on extremely crappy roads. The return trip was OK, took a different route that wasn’t so hard on the car’s suspension (and consequently my shoulders).

This was a couple of weeks ago.

It’s layoff season everywhere, and I feel lucky not to have been laid off. Yet. Hopefully, I retain my job.

More about all that in a little while.

Posted in Not Worth Reading | Leave a Comment »

Posted by kovaiputhalvan on December 29, 2008

Argh.

Time – that wretched four letter word of which I seem to be always in short supply. That pisses me off to no end.

My workplace has closed down from the 29th of December until the 3rd of January – economy measures and all that. Which means I have eleven days at my disposal to do what I please, (if you throw in the weekends).

What have I been up to? I spent a day getting the broadband connection up. The effing builder who’d built the apartment complex got away with laying el cheapo PVC pipes to carry water. I stumbled upon this fact when the AirTel guys broke one of the aforementioned pipes open with a crowbar, in their efforts to cut a path for the broadband cable through the concrete walkway in the parking lot. The resourceful watchman, Bahadur (as resourceful watchmen in apartment complexes are likely to be named), turned off the valves on the terrace, and the entire building was left without water. I ran behind a plumber (not literally), and got the pipe fixed – which took about half a day. AirTel has rather efficiently outsourced each part of their operations to different contractors – which means that a bunch of guys dig up the roads and the concrete (to be fair, they patch up what they dug out – rather well, I should say), another bunch of guys takes care of the wiring woes, and a third bunch arrive at your doorstep to activate the connection. AirTel does a very good job of ensuring that these disparate collections of skilled workpeople stay sycnronized. It’s just that the entire process sucked out the better part of my day from me – no fault of AirTel, though.

I’ve been reading up on the Peano axioms and mathematical induction, which has been immensely satisfying. I didn’t realize just how long it had been since I’d put pencil to paper. This is trivial undergrad stuff – but for someone on the wrong side of thirty who’s not really been exposed to math (except for a couple of algebra/random process courses that were required for signal processing), this is heady stuff indeed. More about that later.

There is a post elsewhere that I must respond to. Later, though. I’m consciously trying not to succumb to the SIWOTI syndrome.

Update:Drat. I was also wrong – that sentence about the Peano axioms and induction – well, induction is a Peano axiom itself. Grrr.

Posted in Not Worth Reading | 1 Comment »

Posted by kovaiputhalvan on December 26, 2008

Moved into new house.

Got broadband today. Airtel. Blazingly fast so far. Heard good things about it, that it’s the only /reliable/ broadband around here…

Hopefully it’s true!

I’ll. Be. Back.

Posted in Not Worth Reading | 1 Comment »

Posted by kovaiputhalvan on October 20, 2008

It has been a while since I last wrote.

Much water has flown under the bridge – my better half and I invested in a flat (with the aid of the friendly neighbourhood bank, of course) – this was at least a month before the beginning of the gooey kablooey. We’re currently blowing the last of our savings on furnishing and decorating the flat. Sigh…

Bloody Wednesday, the 15th of October, is a date that will haunt me in my nightmares for the rest of my lifetime.

Relatives – bloody or otherwise – suck. Period.

The Little Devil is hell bent on scaring the crap out of us once in a month. Fell sick after his measles shot this Sunday. Is recovering. Slowly. Sometimes I really wonder if it was right on my part to have brought a child into this world. Watching the little guy suffer and his not being able to say anything about it just kills me.

New scratch on the car’s bonnet. I pissed off a tempo guy who took his revenge on me. My car’s bonnet, that is. Car seems to have reduced pickup, and seems to make funny noises every now and then. A visit to the service station is due… so is the consequent hole in my wallet. Drat.

I haven’t spent much time reading the stuff that I want to read. There are a couple of interesting articles in the last 3 issues of CACM that I really want to finish. I looked on CACM as a waste of paper until the new editor took over – these days I look forward to seeing the colourful CACM cover in the mailbox every month – not to mention the last few pages.

On a related note to the last paragraph – I find myself humbled yet again by a simple looking problem. It just goes to show that… I haven’t been spending time solving problems. Soon, very soon… I need to tie up a few loose ends and then I’m gonna make sure that I get to have some time for myself. The problem that screwed me this time? Evaluate \int_0^{\pi/2}\frac{x }{tan(x)}{\mathrm d}x. Never have I hung my head lower in shame.

On the whole, life’s been pretty much the same – perhaps there’ve been more downers than uppers, but that’s still OK.

Posted in Not Worth Reading | Leave a Comment »