back to list

Prime-based Rank 2 temperament search code

🔗Graham Breed <gbreed@gmail.com>

1/7/2006 12:39:18 PM

I've got my latest code online. It does the calculations you need to find rank 2 temperaments without worrying about tonality diamonds or general wedge products or any other cruft:

http://x31eq.com/temper/regular.py

It tests itself if you run it as a script -- churning out lots of unreadable generator mappings. It's pretty fast, partly because I optimized the ET search code for the weighted RMS. That means TOP looks unfairly slow, but it was still very slow to start with. You need external libraries to do the TOP optimization.

Then this code uses Herman's simple wedgie function instead of inverse modulos and the like:

http://x31eq.com/temper/regular_wedgie.py

It's a bit shorter than the other code, and also a bit slower. A lot of the extra time is spent in the hcf routine, probably because it has to loop over the whole wedgie to check for contorsion, and the wedgies get quite big in the 31-limit.

Graham

🔗Gene Ward Smith <gwsmith@svpal.org>

1/7/2006 2:32:59 PM

--- In tuning-math@yahoogroups.com, Graham Breed <gbreed@g...> wrote:

> Then this code uses Herman's simple wedgie function instead of inverse
> modulos and the like:

I used a triangular distance function, which should also be fast.
You'd have to take a look to see which is faster, but it looks like
probably Herman has me beat, because I use a few multiplications. You
put u[i]*v[j] - u[j]*v[i] for vals u and v in the kth position, where
k = n*(i-1) - i*(i+1)/2 + j, with n the length of u and v.