getcell equivalent in jit.expr?

    Dec 31 2007 | 5:03 pm
    I've been simplifying some patches with jit.expr, and I'd like to use specific scalar cell values from an input matrix within the calculations. Is there a simple way to do this? The only way I have been able is by making a separate matrix that takes getcell messages and outputs to additional inputs of a jit.expr object. Such a method works, but seems very wasteful to me. It's also not easy to expand to multiple simultaneous cells without making a new matrix for finding each value needed. Is there a way of doing this inside the jit.expr itself?
    For example, with a 1D vector I want the value when cell[0]==50
    Initially I tried "sum((cell[0]==50)*in(0))", but found there was no summation command.
    Here is a simple patch to hopefully explain visually.

    • Dec 31 2007 | 11:45 pm
      This sort of thing isn't possible within jit.expr syntax (without leveraging instances of jitter objects), but is pretty simple to do within an abstraction using jit.matrix.
      Something like the following should work: