odd jit.expr behavior

    Jun 19 2006 | 11:15 am
    Maybe I'm doing something with jit.expr that I'm not supposed to, but
    can someone explain the result of this little patch?
    It prints out "0 0 0 0" in the max window when you press the bang
    button. I would expect that using a constant in jit.expr would
    output that constant, not 0. I'm not saying that this is a bug, but
    it's what I would expect jit.expr to do in this case.
    In the end, what I'd like to do is replace everything in a few
    specific planes of an incoming matrix with a constants. I just
    wanted a simple patch that created a "noisy" hue along very specific
    lines, and held the saturation and luminosity of the video constant,
    but due to the problem (or my misunderstanding) above, it doesn't
    work that way I'd like:

    • Jun 19 2006 | 11:44 am
      sorry, I should have read the fine print first before sending this
      example - jit.expr only supports float32. Duh.
      But there's still the same unexpected behavior using float32 - in
      this new patch, try first banging jit.expr - it will print "0. 0. 0.
      0." to the max window. Then, try banging the jit.matrix - it will
      print the correct constants "1. 0.5 0. 0.1" to the max window. Since
      jit.expr is only supposed to print out the constants defined in it's
      expression, i'd consider this at least bug-like - it shouldn't matter
      whether or not i send it a valid matrix, those constants should
      always come out, or an error, but especially not "0 0 0 0".
    • Jun 19 2006 | 2:13 pm
      I beleive that jit.expr only supports float32 matrices.
    • Jun 19 2006 | 3:43 pm
      Thanks for pointing this out, Evan. I can reproduce here.
      FWIW, jit.expr converts all types to float32 internally, so it will be
      less efficient with other data types, but it should still work (assuming
      the data easily converts to float32). This appears to be a different
      thing altogether.
      Until we can fix this behaviour, the simple workaround is to either use
      the "setall" jit.matrix message or always send a matrix through jit.expr.
      Andrew B,
    • Jun 19 2006 | 5:26 pm
      Great. The workaround is fairly easy, I did wind up using setall.
      Luckily, I'm dealing with very small matrices and so sending them to
      jit.expr each time isn't a problem this time, either. Thanks for
      taking a look at it.