How is gfor implemented?

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

How is gfor implemented?

Postby wingated » Fri Jan 01, 2010 5:39 pm

Hi Acceleryes guys!

Jacket is great -- I'm lovin' it. I have a question which is a little bit off-topic, so I hope that you don't mind.

I'm working on turning Matlab into a probabilistic programming language (possibly using Jacket to accelerate certain operations).

As part of my project, I need to "override" for loops to do a little bit of bookkeeping at the beginning and end of for loops -- I need to implement my own version of your gfor ... gend construct.

The problem is that I have no idea how you did it! I've been looking for something like this for a long time, so I was quite excited when I saw that you managed to do it.

Would you mind sharing the secret? I don't need any code for gfor -- I'd just like to understand how you actually accomplished it.

(I know that I can define an M file named "gfor", which will receive an iteration expression like "i=1:10" as a string if used in a gfor-style expression, and I understand how eval could be used in conjunction with some clever string processing to figure out what to iterate over. But I don't understand how to access the expressions between gfor and gend).

Any help would be appreciated, and again -- thank you for a great product!

-- David
Posts: 1
Joined: Fri Jan 01, 2010 5:33 pm

Return to [archive-commercial] Programming & Development with ArrayFire