代码示例:
voidConvert(doubleBMWL,doubleNORMAL,double*BMwindowVct,float*RR,int*rR,intlenz,double*RRproc)
{
double*X=NULL;
double*Y=NULL;
if(NULL==X)
{
X=newdouble[BMWL];
}
if(NULL==Y)
{
Y=newdouble[NORMAL];
}
for(inti=0;i<BMWL;i++)
{
X[i]=BMwindowVct[i];
}
for(inti=0;i<NORMAL;i++)
{
Y[i]=RR[(int)rR[i]];
}
double*zptr=NULL;
doubles;
double*xp=NULL;
double*yp=NULL;
intn,n_lo,n_hi;
double*Z=NULL;
if(NULL==Z)
{
Z=newdouble[lenz];
}
zptr=Z;
for(inti=0;i<lenz;i++)
{
s=0.0;
n_lo=0>(i-NORMAL+1)?0:i-NORMAL+1;
n_hi=BMWL-1<i?BMWL-1:i;
xp=X+n_lo;
yp=Y+i-n_lo;
for(n=n_lo;n<=n_hi;n++)
{
s+=*xp**yp;
xp++;
yp--;
}
*zptr=s;
zptr++;
}
for(inti=0;i<lenz;i++)
{
RRproc[i]=Z[i];
}
delete[]X;
X=NULL;
delete[]Y;
Y=NULL;
delete[]Z;
Z=NULL;
intm=0;
for(intl=(ceil((double)BMWL/2-2));l<(ceil((double)BMWL/2)+NORMAL-2);l++)
{
RRproc[m]=RRproc[l];
m++;
}
}