Quantcast
Channel: eX-SI » arrays
Viewing all articles
Browse latest Browse all 20

Using Generate Sample Set to avoid the Repeat node

$
0
0

Hat tip to Oleg who posted this tip on the mailing list some time ago.

The basic ideas is that instead of looping over an array with a Repeat with Counter, you use Generate Sample Set to get a data set, and you do everything in a per-generated element context.

GenerateSampleSEt_vs_Repeat

As an example, let’s revisit the problem of taking one array and creating a new array where each element is the sum of the elements before it.

Array_accumulation

The old way, with a Repeat with Counter node, looks like this:
RepeatWithCounter

Using Generate Sample Set, you can work with a data set and use that to access the array elements:
GenerateSampleSet

Generate Sample Set is set up to give an exact number of samples:
GenerateSampleSet-PPG



Viewing all articles
Browse latest Browse all 20

Trending Articles