title: Matlab Mexfiles and Cuda: Evaluate function handle
body: <p>Hey there,
  I have a mex file which I want to parallelize with the help of CUDA. The current functionality is: I pass a function handle and a huge number of 'points' to the mex file and it evaluates the function on each of the points in sequential mode (on the CPU). It therefor uses something like:</p>
  
  <pre><code>mxArray* y;
  const mxArray *e[2] = {functionHandle, point};
  mexCallMATLAB(1, &amp;y, 2, (mxArray **)e, "feval");
  </code></pre>
  
  <p>to evaluate the function Handle on the point using the matlab-function feval. Now I wonder what happens when I try to parallelize the calculations via CUDA: Will this work correctly? Because if the evaluation with mexCallMATLAB is done on the CPU, there won't be any benefit using CUDA. But how to do it than? I can't imagine any way to evaluate a function handle on a certain point in C directly without using the matlab-function feval...</p>
  
  <p>Thanks so far!
  You'll help me a lot!</p>