This site is best viewed in a browser that conforms to web standards.



BOOL ivorix_epma (
vector<double>& ivec, // input vector
vector<double>& ovec, // output vector
unsigned long span) // time period or span of embedding
{
ULONG x = 0;
ULONG y = 0;
ULONG p = 0;
ULONG e = ivec.size();
double sum = 0;
double f = 0;
double w = 0;
if ( span == 0 || span >= e )
return false;
ovec.resize(ivec.size());
ovec[0] = ivec[0];
for ( x = 1; x < e; x++ )
{
sum = 0;
p = min(x, span);
if ( p <= span )
f = 2.0 / (p * (p+1));
for ( y = 1; y <= p; y++ )
{
w = (3* (double)y - p - 1);
sum += w * ivec[x-y+1];
}
ovec[x] = f * sum;
}
return true;
}