title: Vectorized LUT classification using ArrayFire
body: <p>Is there a way to write a vectorized table lookup using ArrayFire?</p>
  
  <p>I'm trying to implement a binary 2D pixel classifier using a 255x255 lookup table. This table contains the 2 channels value combinations [0,255] which should be classified: E.g.<br>
   <code>channel[0] == 127 &amp;&amp; channel[1] == 200</code> would be available for lookup as <code>lut[127][200] == True</code>.</p>
  
  <p>The non-vectorized pseudo-code example:</p>
  
  <pre><code>for pixel in line  
      output[pixel] = LUT[ pixel[channel_0] ][ pixel[channel_1] ]
  </code></pre>
  
  <p>Possible approaches for ArrayFire:</p>
  
  <ul>
  <li><p>[Gfor loop]<br>
  The following doesn't seem to be a valid syntax, so I'm not sure if this is altogether possible:</p>
  
  <p><code>gfor(af::seq i, line.dims(0)) { classification(i) = lut(line(i)); }</code></p></li>
  <li><p>[Custom CUDA kernel]<br>
  Upload both the lookup table &amp; the input line (possibly in segments) &amp; distribute over blocks.</p></li>
  <li>others?</li>
  </ul>
  
  <p>Any help would be greatly appreciated!</p>