A couple of questions regarding jit.expr

    Nov 28 2011 | 3:37 pm
    Hi there, I've been trying to get my head round jit.expr, I've read the reference and help file and the very helpful 'Demystifying Expressions In Jitter tutorial' and understand the basic stuff.
    The first thing I was wondering is if I have a variable ie. $f1, how do I input this number? Simply connecting a flonum box to the input of jit.expr doesn't seem to work. Is there something I have to prepend the number with for jit.expr to notice it?
    Also I have come across 'gtp' in some patches and I can't find this in any of the documentation.

    • Nov 28 2011 | 5:12 pm
      Jit.express is for matrices. You'd need to put that float in a matrix using an empty jit.matrix foo 1 float32 4 4 (or whatever planes and dimensions) and send the message setcell 0 0 val $1
      Or use jit.fill to populate the matrix. Then jit.expr can work.
      If you are just doing math on a number, use expr
    • Nov 28 2011 | 6:36 pm
      Thanks. Any idea what 'gtp' is? the expression is: [jit.expr @expr "gtp(in[0].p[0], $f1)" "in[0].p[1]" @out_name newspectrum]
      The $f1 is where I want the variable. Would I have to modify this with the 2nd matrix?
    • Nov 28 2011 | 6:46 pm
      gtp is greater-than-pass. If the value is greater, it will be passed instead of returning 0 or 1. $f1 style arguments don't work in jit.expr. You have to use in[0] instead.