Peculiar element-wise arithmetic

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

Moderator: pavanky

Peculiar element-wise arithmetic

Postby pzu918 » Sat Feb 22, 2014 2:09 pm

Hi everyone,

I ran into some rather weird element-wise arithmetic problem. The code is pretty simple and straightforward.
ArrayFire lets me do the following without any issue
Code: Select all
a = k * arr * exp(-k * arr) / k;

but runs into an unexpected exception when I was trying do
Code: Select all
a = (k * arr) * exp(-k * arr) / k;

Code: Select all
a = (0.1e1 + k * arr) * exp(-k * arr) / k;
Posts: 1
Joined: Sat Feb 22, 2014 2:01 pm

Re: Peculiar element-wise arithmetic

Postby pavanky » Mon Feb 24, 2014 1:29 am


Please replace exp with af::exp and see what the behavior is ? Also please put a try catch block around arrayfire code and let us know what the message inside the exception is.

You can checkout the helloworld.cpp file for reference. ... xample.htm
Pavan Yalamanchili,
~ If it is not broken, you have not tried hard enough ~
User avatar
Site Admin
Posts: 1123
Joined: Mon Mar 15, 2010 7:39 pm
Location: Atlanta, GA

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