Lair Of The Multimedia Guru

2010-07-21

Building a polynomial out of its roots

Building a polynomial out of its roots is not particularly hard, one just multiplies the corresponding linear/first degree polynomials. But this isnt fast, even doing it recursively and using FFT based multiplication isnt all that great its still O(nlog2n). We can under some circumstances get rid of one of these log(n) factors as ill describe in a moment below. But first i wonder if below is the best that can be done or if iam silly and theres a faster or simpler way?

The idea of this method is not to build up the polynomial coefficients but to build up a vector of polynomial evaluations at evenly spaced points. Doing this for a linear factor “prototype” like x-1 on m points costs us O(m). next we build a sparse vector that is 1 where its index matches a root (and 2 for double roots,…) otherwise its 0. Now we can almost build our evaluation of the final polynom by convolution, just that convolution adds its terms while we need the factors multiplied of course. The solution is simply to convert the evaluation of the “prototype” linear factor by elementwise log() before convolution and by exp() afterwards. The value for log(0) does not matter for us except for numerical stabilty, we have to after exp() reset all roots to 0 anyway. With log(0)=0 one gets first order derivatives at the roots though. Also one can implement this using clasic log/exp and a complex value fft or finite field log/exp with a real or finite field fft. The last step of turning the evaluation vector of our polynom into coefficients can be done with a finite field fft. This make the whole thing run in O(m logm) time for a field size of m.

Whats annoying on it is that the the first part works with samples evenly spaced (aka an additative subgroup) while the second, that is turning the evaluation into coefficients is on a multiplicative subgroup of a finite field. In practice that means while my roots are along a multiplicative subgroup of GF(216+1) i have to apply the rdft over the whole field. which is kinda feeling like a waste of cpu cycles

Suggestions to improve this are welcome. Also alternatively if one knows of a linear time method to zero pad in the frequency domain a block of size 2n to twice its size than the resursive multiplication variant should also run in O(n logn) time.

Filed under: Error Correcting Codes,Optimization — Michael @ 02:40

2010-05-01

Modern notebooks

My acer NB today: Critical temperature reached (101 C), shutting down.
And disablng power management of the HD produces errors after a while, not just today but always.

Filed under: Hardware,Off Topic — Michael @ 18:57

2010-04-14

“Latest” firefox

A little rant to keep my blog from rotting, firefox after 3.0 or so no longer works on kernels that randomize memory allocation a bit. Ones choices are either patching firefox or to disable the randomization for it. And we all know if one application needs all the security layers one can get then its the modern web browsers.
Not to mention how one can be so lame to have such bug open for ages and still not even produce an error message but rather run mmap() munmap() in an infinite loop.

Filed under: Off Topic — Michael @ 21:14

2010-01-29

Votes

About a month ago we (the ffmpeg team) voted about which name our NGO to which people soon will be able to donate should have. A sideeffect of that is that the world now has one more application to count votes using various condorcet methods, borda count and instant runoff voting. Get it from svn://mplayerhq.hu/michael/trunk/ffvotetov with your favorite command line svn client while its still fresh ;).

The vote itself went pretty well, we had a huge participation and it was quite fun :). Less funny was that murphy hit us and the winning choices “FFmedia/Foundation for free multimedia” domain name was already taken by some anonymous person through domaimsbyporxy, who asked us for cash even to just forward a message. Luckily the 2nd most popular choice “FFMTech/Foundation for free multimedia technolgies” didnt had that problem and was just by 1 vote behind so we picked that.

About which voting method is best, i dont know, but for our vote at least they all produced the same result most of the time while people added their votes. In that sense i wonder if any vote in reality that used a condorcet method actually ever needed rules beyond condorcet like the popular schulze method? Anyone knows? i checked debians past votes but it seemed they all had a condorcet winner

Filed under: FFmpeg — Michael @ 01:03

Powered by WordPress