Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- IPP optimized version for EMA needed (Exponential Moving Averag

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

reportbase

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-13-2011
02:59 PM

36 Views

IPP optimized version for EMA needed (Exponential Moving Average)

The exponential moving average is probably the most commonly used moving average

in financial applications. The 'C' version is shown below.

Test case is also shown at the bottom.

Anyone up to converting this to a IPP optimized function. Shouldn't

be to hard, it just consists of addition/subtraction/division. I might

be able to pay you for your time. I also have other 'c' functions

that could be rewritten if someone gets motiviated. Test case

with performance before and after would be useful.

This would be a good function to add to IPP, its used very commonly.

For more on EMA:

//(Close - EMA(previous day)) x multiplier + EMA(previous day)

void ema_32f(const float* src, float* out, int size, int factor)

{

IppStatus status;

float k;

int n;

n = size - factor;

ippsMean_32f(src + n, factor, &out, ippAlgHintFast);

--n;

k = 2.0f / (factor + 1.0f);

for(int m = n; m >= 0; --m)

out = ((src - out[m + 1]) * k) + out[m + 1];

}

float data[] = {22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29, 22.15, 22.39,22.38, 22.61, 23.36, 24.05, 23.75, 23.83, 23.95, 23.63, 23.82, 23.87, 23.65, 23.19,23.10, 23.33, 22.68, 23.10, 22.40, 22.17, 22.17, 22.17, 22.17, 22.17};

float result[20];

ema_32f(data, result, 30, 10);

assert(std::abs(22.296 - result[0]) <= 0.01)

assert(std::abs(23.222 - result[19]) <= 0.01)

2 Replies

Chao_Y_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-15-2011
07:24 PM

36 Views

reportbase

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-16-2011
03:13 PM

36 Views

Many financial algorithms could really benefit from being converted to IPP. These financial algorithms are all pretty simple and no more complicated than EMA.

I use IPP where I can, but we still need to do straight 'C' for much of our work. I'd love for IPP to do the heavy lifting. Most of these financial algorithms are in the public domain and would be perfect for IPP. I just don't have much background in low level SSE2 and SSE3 or however IPP is done. As a 'C' programmer, IPP abstracts away the difficult bits, so I can just code in 'C'. Thanks for awesome library.

For more complete information about compiler optimizations, see our Optimization Notice.