According to the documentation (http://www.arrayfire.com/docs/page_gfor.htm#gfor_iterator) the gfor iterator can be used in expressions:
int m = 2, n = 3;
array A = constant(1,n,n,m);
array B = constant(1,n,n);
gfor (seq k, m) {
A(span,span,k) = (k+1)*B + sin(k+1); // expressions
}
This example does not compile with g++ nor with clang. They both complain about
use of overloaded operator '+' is ambiguous
If I change k+1 to k+1.0 to avoid the ambiguity (i.e. force a double), the program compiles, but fails at runtime:
C++ exception with description "ArrayFire Exception(203): Invalid input size
In "arrayfire/src/api/cpp/array.cpp:926" thrown in the test body.
ArrayFire version is 3.1.0.
According to the documentation (http://www.arrayfire.com/docs/page_gfor.htm#gfor_iterator) the gfor iterator can be used in expressions:
This example does not compile with g++ nor with clang. They both complain about
If I change
k+1tok+1.0to avoid the ambiguity (i.e. force a double), the program compiles, but fails at runtime:ArrayFire version is 3.1.0.