Medians (Part IV)

September 19, 2017

I’ve visited the median problem a couple of times already. The median is the value in the middle of a sorted list of values. If the list is already sorted, that’s not much of a problem. If it isn’t, then we must use some efficient way to do it.

Read the rest of this entry »

Undo that mess

September 12, 2017

During last marking season (at the end of the semester), I had, of course, to grade a lot of assignments. For some reason, every semester, I have a good number of students that write code like they just don’t care. I get code that looks like this:

int fonction              (int random_spacing)^M{           ^M
  int            niaiseuses;

  for (int i=0;i<random_spacing;         i++){
         << bleh
         << std::endl;


There’s a bit of everything. Random spacing. Traces of conversions from one OS to another, braces at the end of line. Of course, they lose points, but that doesn’t make the code any easier to read. In a previous installment, I proposed something to rebuild the whitespaces only. Now, let’s see how we can repair as many defects as possible with an Emacs function.

Read the rest of this entry »

Halton Sequences (Generating Random Sequences VII)

September 7, 2017

Quite a while ago, while discussing Monte Carlo Integration with my students, the topic of choosing sample locations came up, and we discussed low-discrepancy sequences (a.k.a. quasi-random sequences). In a low-discrepancy sequence, values generated look kind of uniform-random, but avoids clumping. A closer examination reveal that they are suspiciously well-spaced. That’s what we want in Monte Carlo integration.

But how do we generate such sequences? Well, there are many ways to do so. Some more amusing than other, some more structured than others. One of the early example, Halton sequences (c. 1964) is particularly well behaved: it generates 0, 0.5, then 0.25 and 0.75, then 0.125, 0.375, 0.625, and 0.875, etc. It does so with a rather simple binary trick.

Read the rest of this entry »

l8r, allig8r

May 2, 2017

See you all in september!

Finding dependencies for Make

April 25, 2017

How hard is it to get dependencies for your project to use in a Makefile?

Well, it depends.

Read the rest of this entry »

Reading cassettes, tout azimuth (Part II)

April 18, 2017

Last week we started to look at the problem of azimuth alignment on olden compact cassette tape drives, and how this misalignment affects the sound. Let’s now have a look at how azimuth affects the frequencies.

Read the rest of this entry »

Reading cassettes, tout azimuth

April 11, 2017

While reading on compact cassette readers (as part of a preliminary study on digitizing archives) I found out that azimuth, or the angle made between the tape and the reading is a considered a big issue, the best case being an azimuth of exactly 90°. I could not, however, quite find what was the effect of varying that angle, even if pretty much everyone agrees that it somehow lessen the tape’s high frequency response. Let’s see how, exactly.

Read the rest of this entry »