Pls let me know why the code bellow shows invalid results(sum) when NR is greater than 1999.
#define NR 2000 // MEAN=1 but invalid SUM !
//#define NR 1999 // MEAN=1 and SUM==1999 of course
#define DIM 4
void Test()
{
VSLSSTaskPtr task;
int errcode,dim = DIM, n=NR,x_storage=VSL_SS_MATRIX_STORAGE_COLS;
double x[NR*DIM],mean[DIM], sum[DIM],W[2];
W[0]=0; W[1]=0;
for(int j=0;j<DIM;++j) {mean[j]=0;sum[j]=0;}
for(int i=0;i<NR*DIM;++i) x[i]=1;
errcode = vsldSSNewTask( &task, &dim, &n, &x_storage, (double*)x, 0, 0 );
errcode = vsldSSEditTask(task,VSL_SS_ED_ACCUM_WEIGHT,W);
errcode = vsldSSEditTask(task,VSL_SS_ED_MEAN,mean);
errcode = vsldSSEditTask(task,VSL_SS_ED_SUM,sum);
errcode = vsldSSCompute( task, VSL_SS_MEAN | VSL_SS_SUM, VSL_SS_METHOD_FAST );
for(int i=0;i<dim;++i) printf("M[%d] %g S[%d] %g\n",i,mean[i],i, sum[i]);
errcode = vslSSDeleteTask( &task );
}
The result when NR=2000 is:
M[0] 1 S[0] -2.65698e+303
M[1] 1 S[1] -2.65698e+303
M[2] 1 S[2] -2.65698e+303
M[3] 1 S[3] -2.65698e+303
I got this result under
Windows 8.1
Intel(R) Math Kernel Library Version 11.1.3 Product Build 20140416 for 32-bit applications