I tried to learn about the implementation of that algorithm but got sort of lost inside the guts of euclidean.pd, so I went through G. Touissant's publication and made something like that using a table and lists, as @sebfumaster was asking for.
As far as I could read in a PhD Thesis (Musical Rhythms in the Euclidean Plane) from Perouz Taslakian, a student at the same university as G. Touissant, the original patch uses two different algorithms depending on the proportion of hits to remaining rests. The matricial approach is adequate for that but quite troublesome (IMHO) in pd. If your amount of hits is less than the amount of rests (k <= (n-k)) it goes somewhat like this: It consists in putting a whole bar like this on the first line, for instance:
22211111 (twos are hits and ones are rests, the rest of the empty matrix is zeros)
Then you begin moving the remaining ones one row below the twos, which stay on first line, and moving what remains at the second line "out of the shade" of the previous line to the third one:
... until you have a pack like this:
Then you start reading column wise and from left to right, obtaining:
where: '211' comes from the first column, '211' from the second and '21' from the third one.
The method for more twos than ones is something alike but with slightly different rules.
I saw that for this second condition the answer is the same if one inverts twos and ones and reverses the bar, then solves it using the first method. After that one must invert again and reverse. For instance:
22211 -> invert -> 11122 -> reverse -> 22111
Solving in a matrix:
Read columnwise and from left to right: 21121
Then reverse again: 12112 and invert: 21221.
I found that euclidean rhythms can be made by using a table, putting the starting vector in the same manner and reading it in an alternate way, using division reminders to find out the pointers to the table. Well it's done like that in my patch and it's very easy to follow. However, the rhythms are not exactly the same as euclidean.pd patch gives but since phase shifted euclidean rhythms are equivalent, it doesn't matter to me at least. No matrix button this time.
I think that with not so much work you can turn it into what you are looking for.
Thank you very much @kyro and @mrcold to introduce me to this. It has been something I was going to need soon.
PD: I appologise for the extension of this post
Debian Stretch on Lenovo T450i, Lexicon Omega.
Pd-vanilla 0.49.0-3~bpo9+1 (installed from repo)