Get the Equal Values off 2 spreads

I came across this weird problem I couldn’t figure out myself.

If I have 2 spreads (integers) with different spreadcounts, how do I figure out the values that BOTH spreads have in commen (if any)??

I have done a workarround for the patch I was working on, but I couldn’t figure it out if I ever REALY needed it.

I could patch something massive, taken 1 slice each time and compare that with the other spreads, but for big spreads this would take ages. (1 frame/slice)

Hope someone knows an easy answer.

SimulairValuesIn2Spreads.v4p (2.4 kB)

hi! it would be better to sort both slices (convert them into strings and use sort (string) and then use a = (String) to get duplicates.
You can then use the “former index” pin of the sort nodes to reorder the spread to it’s previous order.

how do I figure out the values that BOTH spreads have in
commen (if any)??

Sift can do that, but only for strings. So you need to fiddle with AsString and AsValue aswell.

I agree there could be a Sift for Values. I think your problem is one of the basic loop problems, where no clean solution in vvvv exists yet.

there is another possibility.
i made a patch working with the almost unknown Countindices node.
but it only works fine for small positive integers…

2spreads.v4p (8.4 kB)

Hmzz… converting it to a textstring was not the first thing on my mind. I also patched something like gregsn (and ad the last stap off actualy getting the values).

Mine seems a bit more complex than the one with Countindices, and it only works for positive integers. And you should keep them below 1000 or something, cozz you get a very large spread.

SimulairValuesIn2Spreads.v4p (20.9 kB)

tip: in the upper part of your patch where you are dealing with switches you could replace that part with a single max with 4 inputpins.

i still reduced my version. maybe it is helpful. but for sure it has the same limitations like yours: it is only working at a reasonable speed for relatively small positive integers.

but for this case it might be much faster than the string version.

2spreads.v4p (7.1 kB)

Thnx for the Max tip, need to learn to make a better use off the inspector.

That Select Node you used is super!! And I think some one should re-do the helpfile!! (cozz I realy missed that option).

Was thinking off multiplying the value with 10000 for fractions, and than deviding with 10000 in the end, but than I get rounding errors. 0.1667 becomes 0.1666. Also working with a 10000 spreadcount isn’t that nice.

Placed a wish in the wishlist… who knows when some genious has an lost hour off two.