Page 1 of 3

quick qay to perform multiple operations?

Posted: Wed May 08, 2013 12:53 am
by tester
I need to perform multiple similar operations on the fly witing a set of inputs, something like this.

If you have N inputs, and want to substract each one with everyone else, to get an array, then yoy need to perform N(N-1)/2 operations. For many inputs there would be too many simplistic blocks to work with.

But I guess there should be a way to make it faster, with some buffering/queue/multitrigger setup?

Generally the whole idea is to:
a) calculate midpoints between multiple input values (reject results if smaller than predefined x),
and b) compare these input values with calculated midpoints, and pick only these in range y (0<y<z).
It's for calculating elements of vibration and harmony.

Re: quick qay to perform multiple operations?

Posted: Wed May 08, 2013 12:48 pm
by tester
My guess is, that such circular counter will be the first step here. Something that will calculate everyone with everyone.

Second step will be probably to add some limiter, to increase the counter for one of the selectors per each iteration? Target formula: N(N-1) / 2

Re: quick qay to perform multiple operations?

Posted: Wed May 08, 2013 10:13 pm
by tester
Okay, I'm stuck. Is there a quick way to substract all elements from one array any elements of that array. and exclude inv duplicates?

Like this:

if array has numbers 400, 300, 200, 100,

then

400-300
400-200
400-100

300-200
300-100

200-100

I'd like to use it for larger arrays.

Maybe no ruby, it may somehow interfere in other things going on in "living" schematics/design. Besides I'd like to do some more (similar) operations after that, and I don't understand ruby. I'd like to understand it on prims.

Re: quick qay to perform multiple operations?

Posted: Wed May 08, 2013 11:13 pm
by tester
Hmm... Like this? Two last must be triggered separately. (works in second re-click, must find out where afterload is required)

//edit:

I don't know if this can be done without initial recalc. see updated version

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 2:29 am
by Jay
it works if you add a little trigger delay onto the after load like below! don't know if that suits your needs m8

combi-updated + trigdelay.fsm
(924 Bytes) Downloaded 1206 times


Best Regards

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 2:40 am
by Tronic
tester wrote:Okay, I'm stuck. Is there a quick way to substract all elements from one array any elements of that array. and exclude inv duplicates?

Like this:

if array has numbers 400, 300, 200, 100,

then

400-300
400-200
400-100

300-200
300-100

200-100

I'd like to use it for larger arrays.

Maybe no ruby, it may somehow interfere in other things going on in "living" schematics/design. Besides I'd like to do some more (similar) operations after that, and I don't understand ruby. I'd like to understand it on prims.


I do not know if I understand correctly what you want to do, but I hope this is.
Subtract_Array_Iterator_(Tronic).fsm
(888 Bytes) Downloaded 1112 times

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 10:20 am
by Tronic
New module, recursive mode , infinite length arrays, and two options result, ordered, or sorted.

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 12:33 pm
by tester
Thanks for responses. Jay - what for the delay there if it works without it? I rather meant to avoid a calculation on startup. Tronic - I dig deeper later into your schematic, to learn something new.

Meanwhile I made a small optimization and with example. And by the way - sorry for confusion; I was talking about substracting, while I was focused on midpoints.

The concept I'm working on is related to calculating resonances and harmony, and pointing references. So here is what I've done for now. General step 1: calculate all possible midpoints between incoming frequencies, and General step 2: compare all incoming frequencies with calculated midpoints.

Now - there are few things more to do. For example - filter incoming array of frequencies from zero-frequencies. Another one - to duplicate array combiner in order to get a list of synchronized descriptors. And third - filter after step 2, to elliminate values greater than pre-defined X. And fourth - to filter somewhere around midpoints smaller than pre-defined Y, to elliminate audible (strong) differential beats.

Thus, the result will end up like this.
Let say that you have 3 input frequencies: f1=200, f2=252 and f3=300.
Then - the output should tell: f2=2Hz (f1-f3).

It get's more complicated if you have bigger lists than 3, but the whole idea is to point these harmonic resonances.

Probably, there is more in the game, like comparing frequencies to harmonic intervals, in the same way.

*

In my example, I thing I need to elliminate somehow the need for using last two elements on array in a separate thread, to make dynamic (resizable) selectors.

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 7:29 pm
by Tronic
I hope I have understood.
:roll:

Re: quick qay to perform multiple operations?

Posted: Thu May 09, 2013 9:33 pm
by tester
Hi Tronic,
It seems to show correct values.

From this point it get's more tricky. Let me think out loud for a few moments.

1. If input data on array equals zero, then there is still a midpoint between 0 and other inputs. But there is no sense of calculating midpoints between zero and X. So these midpoints should be removed.

Sure, input data can be filtered from zero's, but... (...few thoughts below)

2. Output (midpoints compared with input data) should be narrowed/filtered, to values greater than 0, and less than "user value" (guess it will be around 12Hz).

3. Optional (must check how it sounds). Midpoint list should be narrowed, to elliminate data, that come from similar inputs, i.e. f1-f2 should be smaller than 20Hz I guess. So if f1-f2 > "userlimit2", then don't store midpoint, or move it to a secondary list of midpoints. The reason for this is, that below 30Hz difference - differential beats become more audible, and harmonic resonance becomes a problem than benefit.

4. (...the "below" thoughts...). It's easier to calculate all sort of this stuff, but more difficult will be to combine maths with descriptor list (string array).

Let say, that the input array is made of 3 values: 200, 252 and 300.
Second input array is made of 3 strings: f1, f2 and f3.
Indexes for values and strings are constant (f1->200, f2->252,f3->300)
What changes in various projects - is the amount of values/strings (index size).

When the midpoints are calculated on values, string data would be combined with each other, like this:
"f1-f2", "f1-f3", "f2-f3".

When input values are compared to midpoint data, then string arrays will be combined like this (two arrays?):
"f1/f1-f2", "f1/f1-f3", "f1/f2-f3", f2/f1-f2", "f2/f1-f3",...

Now the filtering of values, and corresponding strings

At the end, there will be a list of values and strings, combined like this:

f2=2.00/f1-f3

And I guess some indicator, when things like f1-f3 (math this time) are less than one of these custom limits (20Hz)

I have no idea yet how I make that string associated part, but I thought maybe you have more xperience with it. Using my schemtic, I'm probably able to easy filter unwanted values and midpoints, but then I probably will stuck with associated strings/descriptors. I guess it must be done on synchronized loops. Still with me? ;-)