jit.gen – use of vec

Nov 3, 2011 at 4:48am

jit.gen – use of vec

Not sure what I’m doing wrong here. Example patch below showing simple use of jit.gen and ‘vec’ to combine four single-plane matrices into one four-plane matrix. Output is still single-plane. Is this a bug or have I left something out?

– Pasted Max Patch, click to expand. –
#59769
Nov 3, 2011 at 5:25am

Hi David,
All of jit.gen inputs and outputs have the same matrix format, which is determined by the matrix input to the left inlet. Since all of your input matrices are 1 float32 10 10, the output will also be 1 float32 10 10. Your use of vec is correct, but the output is converted to 1-plane since the output matrix only has 1-plane.

I just looked at the Gen Overview document and don’t see this mentioned. I will add it.

#215121
Nov 3, 2011 at 6:05am

Thanks Wes, seeing a 600% performance gain in by replacing some simple jit.expr calculations with jit.gen (in those calculations). Very exciting.

While we’re on the subject of documentation, I would perhaps suggest that the short explanations of the gen operators that appear in the autocomplete box be clarified for the ‘swiz’ and ‘vec’ operators. They are a little unclear for people unfamiliar with programming technology, but familiar with jitter terminology. For example, ‘Swiz’ currently reads as ‘swizzle and mask vector components’. While I understand that this is a good description in terms of the programming function the operator is actually performing, it doesn’t give much clue as to its most common practical use for most jitter users, that of unpacking multi-plane matrices.

#215122
Nov 3, 2011 at 6:12am

Thanks David. This is a very good point about the documentation. Something more familiar like you suggest is a good idea. 600%, love to hear that!

#215123

You must be logged in to reply to this topic.