PDA

View Full Version : Fast Analog Multiplication



larryjoe701
09-25-2011, 04:32 AM
I just completed a signed analog multiplication chip. It takes two real number values between -1 and +1, multiplies them and spits out the answer as a signed real number between -1 and +1 in one or two cycles.
For example 0.2 (20%) * -0.5 (-50%) = -0.1 (-10%)

Anyone interested in it? I don't have it in a level or anything, but if you ping me I'll send it to you.

For those of you interested in the math...

Figuring this out consumed way too much of my time and brain. I determined that I could fairly easily divide one analog value by powers of three, then add or subtract or ignore those reduced values based on the base 3 representation of the second number. The idea hinged on being able to convert the second value into its base 3 repr, which turned out to be a little tricky. Since I wanted this to be fast and not require an enormous sequencer, I couldn't just convert it whole-sale. I was OK using a sequencer to determine one "trit", but sequencers are slow so that part had to be done in parallel for all the "trits". I thought the key was going to be taking the number mod 1/3, the tripling for each digit. Unfortunately, there really isn't a way to get the discontinuity required by MOD. When I got stuck I also explored basic binary, but it had the same problem.

Ultimately I discovered I didn't really need the sharp rise of MOD (/|/|/|/|)... instead I could use a triangle wave (/\/\), which is much easier to obtain given LBPs reflecting around -1/+1 and absolute value operations. Any time the trit ended up having the middle value, flipped all the subsequent additions or subtractions. Given another middle value, just flip the rest back.

So ultimately I ended up with an equation something like this:
B/2 + A[1]*B/3 + A[2]*B/9 + A[3]*B/27...
where B is the raw analog value and A[n] is the nth digit in the ternary representation, using -1, 0, & 1.

Seems to work pretty well!

RickRock_777
09-25-2011, 04:42 AM
Great job larryjoe701. I don't really have a need for this tool, but I did want to say this is very impressive. My hat's off to you. :)

Links_r_us
10-01-2011, 04:20 AM
Very nice! If you dont mind, I really want this :)

My psn is: Links_r_us

Ayneh
10-02-2011, 04:14 PM
Cool, I'd be interested in having a look at it.

PSN ID is same as username.

BasketSnake
10-09-2011, 12:44 AM
!#&"&% trit trit "#&

SebasSBM
11-07-2011, 10:07 AM
I've been wondering if multiplying analogues fast were possible... I'm interested on it.

My PSN ID: SebasSBM.