# vecdotf on circular buffers

Question asked by JohnPower on Jun 23, 2011
Latest reply on Sep 6, 2011 by StuartS

Hello Engineers!

I'm currently working for the first time with a DSP due to my master's thesis which is about active noise cancellation.

I've came across the problem to compute the dot product of a regular array and one array used as circular buffer. My solution to this until now looks as following:

```#define FLOAT_TO_INT_FACTOR 2147483648.0

float floatToSend;
float dm coefficients[COEFF_COUNT];
float pm templateInt[COEFF_COUNT]; //being my circular buffer
int templatePosition;

//here, new coefficients are calculated for each new sample received (from error microphone)

floatToSend = vecdotf(
coefficients,
&signalTemplate_int[templateIntPosition],
COEFF_COUNT - templateIntPosition
);

floatToSend += vecdotf(
&coefficients[COEFF_COUNT - templateIntPosition],
signalTemplate_int,
templateIntPosition
);

templateIntPosition = circindex(templateIntPosition, 1, COEFF_COUNT);

*pTXSP2B= (((int)(floatToSend  * FLOAT_TO_INT_FACTOR)) * 256) >> 8;
```

As far as I understand, this is somewhat inefficient because of uneven word boundariers and therwith the use of SISD :/

But now I came across this thread: http://ez.analog.com/message/7821#7821 and from what I understand, it is somehow possible to do the crosscorrelation directly on a circular buffer... at least with a blackfin. Does this also stand for vecdotf() and a SHARC ADSP-21369? And if yes, could you please give me a hint on how to realize it?

thanks,

Markus