We can hack our way to pairwise multiplication using a touch of algebra.
We start with the equation (a+b)^2 = a^2 + 2ab + b^2
Solve for ab: ab = [(a+b)^2 - a^2 - b^2]/2
Now we have something we can calculate with combinators. Use three arithmetic combinators for the squares, one that is connected to both the red and green wire for (a+b)^2, one that is only connected to red for a^2, and one that is only connected to green for b^2. Set all three to each ^ 2 output each. Connect the latter two to an arithmetic combinator set to each * -1 output each. If signal timing is important where you are using this then connect the (a+b)^2 combinator to any combinator that passes every value through (for example each * 1 output each) so it will be delayed the same number of ticks. Connect those to an arithmetic combinator to divide everything by 2. The final result will be each signal on the red wire multiplied by it's corresponding signal from the green wire.
Code: Select all
If the signals on one wire all have a value of 1 then this can be used to filter signals from the other wire.
(I haven't yet figured out how to get pairwise division. If anybody has any ideas, please let me know.)