Quantcast
Channel: Parallel Computing in C++ and Native Code forum
Viewing all articles
Browse latest Browse all 856

Iterating over arrays of different dimensions

$
0
0
I am using C++ AMP with Visual Studio 2012 on Windows 8. I have a case where I have 2D array_view, `experimentData` and a 1D array_view, `experimentFactors`. I want to iterate over the first dimension of the 2D array_view and the 1 dimension of the 1D array_view. This is what I have but I constantly get errors saying there aren't overloads for this. I am wanting to iterate over the `numberOfTests` which is the first dimension. I am wanting the line:
auto test = experimentData[idx];
to return the entire row of data. I think the `section` method on the `array_view` is the way to do this but I can't figure out how.
array_view<int_2, 2> experimentData(numberOfTests, numberOfSolutions, initialConditionSet);
array_view<float_2, 1> experimentFactors(numberOfTests, factorData);
extent<1> e_size(numberOfTests);
parallel_for_each(e_size, [=] (index<1> idx) restrict(amp) {
        auto test = experimentData.section(idx);
        auto factors = experimentFactors[idx];
        analysisAlgorithm(test, factors);
});
The `test` object should be a 1xN section of the `experimentData` `array_view`. The `factors` object should be a single item from the `experimentFactors` `array_view`.

**Clarification**

The `experimentData` array_view has M rows and N columns

The `experimentFactors` array_view has M rows

Viewing all articles
Browse latest Browse all 856


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>