math in a jitter matrix with jit.expr

Andrew Blanton's icon

hi forum!

Max Patch
Copy patch and select New From Clipboard in Max.

i have been hitting my head against a wall trying to get a simple math example working with jit.expr. as you can see on the left i have the expr object working on a single number. the idea is to run this expression in a matrix, but in setting up a simple example (on the right) i am having a fundamental issue, i would like to eventually get this into gen, but this is just my first step. what am i doing wrong? i would think the example on the right would take the cell value and add 2 but as you can see it is not working that way. any help would be much appreciated.

Wesley Smith's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I think you just need to send the float value in once the matrix has been through the left-inlet once:

Andrew Blanton's icon

Wesley,

Max Patch
Copy patch and select New From Clipboard in Max.

first thank you for the help. i still have a fundamental issue, i thought that maybe the jit.expr only works with matrix so i tried to add a second matrix. so essentially what i am trying to do is start with a clean matrix (tester) add the data in tester_2 and take that data and repopulate tester and a bang will repeat this process. so cell 0 0 would produce the output on each bang 1 2 3 4 5 ect... not sure what i am doing wrong though...

Wesley Smith's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Try this. The issue here is that the jit.expr object doesn't know the input matrix size until it gets something in the left inlet. As a result, any inputs in other inlets will be adapted to the left-inlet size. If they are adapted, the original data will be lost.

Andrew Blanton's icon
Max Patch
Copy patch and select New From Clipboard in Max.

ok so i think i have a solve with gen. but this could be a bug, notice in this patch the message box in the top right. if i have it set as is with 1 it will populate the entire matrix with 1 and on each bang increment as expected i.e. 1 2 3 4 in each cell. now if i add 1. to the first int in the message, it will recognize the float and then populate the rest of the matrix with the numbers that i had initially intended. i'm not sure if this is a bug or just my syntax error but i did think you guys should know. thanks again for all of your help!