Rows/columns operation in Jitter or Gen


    Mar 17 2016 | 11:34 am
    Hi folks!
    Is there a way to do matrix operation like:
    1. Multiply N×M by 1×M matrix (multiply each row value from the 1st matrix by the corresponding value from the second). 2. Calculate mean of each row.
    This can be done with jit.spill/jit.fill, but I'm looking for a more FTM- or Matlab-like way on doing this for the whole matrices without doing loops on the scheduler/queue.
    I checked the forum briefly and didn't find a solution. Also I'm new to Gen and don't see a way to do this, because in Gen (as far as I understand) we make the algorithm to be evaluated on each pixel. I don't see a way to do more classical looping techniques there.
    Any help is appreciated.
    Best, E.

    • Mar 17 2016 | 6:59 pm
      for mean, check out jit.planeop for matrix multiply, check out jit.la.mult
      jit.gen has a sample operator, allowing you to access the values of all the pixels of the input matrix, and codebox allows you to do branching and looping. check out the GenExpr reference doc for more info.
    • Mar 18 2016 | 7:48 pm
      I think for calculating the mean of each row jit.dimop would be more useful.
    • Mar 19 2016 | 1:34 pm
      jit.dimop is exactly what I needed! Thanks @jesse!
      @rob, I didn't get how to use jit.la.mult for my task: I need to multiply values from each row from the first matrix by the value from the corresponding row from the second matrix. The output will be the matrix with N×M dimensions. jit.la.mult outputs 1×M.
      Also, will the looping inside codebox be evaluated for each pixel?
      And another question: how to calculate amount of zeros in each row?
    • Mar 21 2016 | 12:11 am
      As long as the larger dim matrix enters the left inlet of a jit.* object it should do the multiplication as you expect.