For loops in jit gen


    Feb 13 2020 | 7:18 am
    Hi,
    I'm a little new to jitter and gfx programs in general.
    I'm a bit confused about how a for loop works in jit gen, or pix?
    For instance, if I limit the for loop to 100, I'm wondering what is this 100 of? Does it split the 1024 dim I have given into 100 points? (ie 10.24 pixels for each point?)
    Also, In matlab, processing etc I can go across the rows and columns of a matrix using the x and y values in a for loop. It's unclear to me how this would be done in jitter. Does jit.gl.pix do this automatically?
    Would be really grateful for some help because coming from an audio background, I'm finding jitter is taking 100s of times longer to code, mainly because of lack of documentation on how jitter compares to other programs.

    • Feb 14 2020 | 8:24 am
      jit.gen (CPU), jit.gl.pix (GPU) apply the code inside in parallel to every matrix item respectively pixel. You can think of these objects to perform a kind of parfor(Matlab) over x and y. https://cycling74.com/tutorials/my-favorite-object-jit·gl·pix/ https://docs.cycling74.com/max8/vignettes/gen_overview jit.gl.pix is actually a presentation of a shader, which means this program runs in parallel for all pixels by means of the GPU architecture. This can dramatical speed up your patch but also means that certain operations are not possible, less performant than on CPU (e.g. certain for loops) or not easy to achieve. E.g. running over pixels and summing them would require to use [sample] in jit.gl.pix. You might be interested in objects like [ jit.dimop] and the cv.jit -package.
    • Feb 14 2020 | 9:35 am
      Thanks so much Martin, loads of food for thought here when I was stuck in a rut :)