Hi All, ro.interleave() is one of those functions I have to look up every time because I can never remember which argument order I need. To address this, I finally "documented it" for myself so I will never need to look it up again. (Documenting things is a great way to burn them into memory.) Here is what I wrote in case it's helpful for anyone else:
// demo_interleave.dsp import("stdfaust.lib"); // $FAUSTLIBS/routes.lib:140 // A bank of parallel signals in Faust may be interpreted as a vector. // In a matrix, each column is a vector. A matrix of signals in Faust // is thus a bank of columns, or successive columns laid out // vertically. For example, an M-by-N matrix appears as M signals // (the first column), followed below by another M signals (the next // column), and so on, for a total of N columns, or M*N signals. // Matrix transposition is efficiently accomplished in Faust using the // ro.interleave(M,N) function, whose input is MxN and output is NxM. // It could have been called matrix_transpose(). // Example: Transpose a 10x2 input matrix to yield a 2x10 output matrix nRowsIn = 10; nColsIn = 2; process = ro.interleave(nRowsIn,nColsIn); // (View it using faust2firefox or the Faust IDE at https://faustide.grame.fr/) On Mon, Sep 13, 2021 at 1:43 AM Yann Orlarey <orla...@grame.fr> wrote: > Hi Lucian, > > A useful function, in this type of routing, is `ro.interleave(N,M)`. It > has the advantage of requiring less work for the compiler, especially when > N or M is large. > > > import("stdfaust.lib"); > > N = 10; > process = ro.interleave(N,2) : par(i,N,*); > > > > https://faustide.grame.fr/?autorun=0&voices=0&name=nbinop&inline=aW1wb3J0KCJzdGRmYXVzdC5saWIiKTsKCk4gPSAxMDsKcHJvY2VzcyA9IHJvLmludGVybGVhdmUoTiwyKSA6IHBhcihpLE4sKik7Cgo%3D > > Yann > > Le mar. 7 sept. 2021 à 15:30, Lucian Boca <lucianb...@gmail.com> a écrit : > >> Haha awesome, thanks James! >> >> I was just putting together a similar implementation based on your >> previous email, ended up with: >> >> ``` >> bop(f, items) = par(i, N, f(ba.selector(i, N, items))) with { N = >> ba.count(items); }; >> ``` >> >> Super useful, thanks again! >> >> On Tue, Sep 7, 2021 at 2:26 PM James Mckernon <jmcker...@gmail.com> >> wrote: >> >>> On 9/7/21, James Mckernon <jmcker...@gmail.com> wrote: >>> > I haven't time to work out the details now. >>> >>> Why do I lie like this? I couldn't resist trying it. I think this >>> should be you what you want. >>> >>> ba = library("basics.lib"); >>> bop(op, list) = par(i, ba.count(list), op(ba.take(i + 1,list))); >>> process = (1,2,3,4) : bop(*, (2,3,4,5)); >>> >> _______________________________________________ >> Faudiostream-users mailing list >> Faudiostream-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/faudiostream-users >> > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > -- "Anybody who knows all about nothing knows everything" -- Leonard Susskind
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users