Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Math Functions???

From: robert:lancaster:opennw at: 11-May-2001 11:05

Thanks for the reply Brian.... So you want to know what convolve is.... Hmmm..... The best way to decribe it is as a function that can be used to mulitply two audio samples together. However it is used for a far more than this.... A 2-D dimensional convolve can be used for Blur and sharpen operations in a Paint Program. Basic 1-d operation...is ( if I remember it correctly ) a: [ 2 4 6 8 10 12 14 18 20 22 ] b: [ 1 3 5 ] B will now be "slid" through A. Any place where A aligns with a value in B will be multiplied and added to a sum. The resultant sum will be appended into an array. First Interation [ 2 4 6 8 10 12 14 18 20 22 ] [ 1 3 5 ] = 2 * 5 Resulting Array = [ 10 ] 2nd Interation [ 2 4 6 8 10 12 14 18 20 22 ] [ 1 3 5 ] = 5*4 + 3*3 Resulting Array = [ 10 29 ] 3rd Interation [ 2 4 6 8 10 12 14 18 20 22 ] [ 1 3 5 ] = 6*5 + 3*4 + 1*2 Resulting Array = [ 10 29 36 ] The Last iteration will be [ 2 4 6 8 10 12 14 18 20 22 ] [ 1 3 5 ] = 1*22 Resulting Array = [ 10 29 36 XX XX XX ... ... ... 22] This carries on until B has 'slid' entirely through A. The resulting arrary will be ( length? A + ( 2 * length? b) long. I was not looking forward to implementing this because of the level of nested for loops required. However in describing it on paper I think i've figured out an easy way to complete the task. Not very effecient mind... Thanks Rob. Lancaster.