Another gfor question

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

Moderator: pavanky

Another gfor question

Postby andywebb » Wed Jun 06, 2012 7:21 am

This is a separate gfor query to the one I already have active. The following code raises multiple errors and even after reading the Wiki for them repeatedly, I still can't see why.
First off, after one iteration of the outer for loop, the warning "{Warning: Last dimension indicates independent iterations (see}" appears at the top of the resultadf window in MATLAB's Variable Editor. Despite this, what seem to be valid result values appear beneath this warning.

However, there also seems also to be an issue of some sort with the underlying data. If I F11 through the gfor loop once, I find that the moment the data vector "alldata(kdx+idx,j)" is passed to the "gadf2" function (where it is assigned the name "x") the exact same warning appears at the top of the x window in MATLAB's Variable Editor. This occurs before even the first line of gadf2 code executes. Why does this happen?

The other issue is predictable in view of the earlier errors in that at the end of the outer for loop, the contents of alladf cannot be cast to a single. Thanks.

Code: Select all
idx = gsingle(0:CointLookback);
alladf = gnan(rows(CointMat)-1,cols(CointMat)-3);
alldata = gsingle(dailyprices(:,3:2:end));
resultadf = gnan(2,535);
for j = 1:cols(alldata)
        gfor kdx = 1:535
            resultadf = gadf2(alldata(kdx+idx,j),0,1,2);             
    alladf(j,1:(rows(alldata)-CointLookback)) = resultadf;

Posts: 23
Joined: Tue Jan 17, 2012 6:20 am

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