title: Calculating Cross Correlation for 1D Signals in C/C++
body: <p>Can someone help me out in doing the cross correlation for 1D signals in C/C++, using libraries such as Intel MKL or FFTW3 or Armadillo or GNU-GSL etc. I am using Ubuntu 18 64 Bit.</p>
  
  <p>Tried a lot of combinations, either library is not getting integrated properly, or it is just calculating the correlation coefficient not the correlation value between the data provided (happening with GSL), my data is huge in numbers, in float, around 30k of listing.</p>
  
  <p>Please help me out with a code logic to work out with these libraries.</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;forkjoin.h&gt;
      #include &lt;shared.h&gt;
      #include &lt;barrier.h&gt;
      int main()
     {
     int *a,*b,pid,nproc,i,*bar,sum1,sum2,size;
     int shmid1,shmid2,shmid3,shmid4,shmid5,shmid6,shmid7,shmid8;
     float *a1,*b1,*ab,*mean1,*mean2,total; 
  
     printf("Enter the size of the array : ");
     scanf("%d",&amp;size);
     a = (int *) create_memory(2*size,&amp;shmid1);
     b = (int *) create_memory(2*size,&amp;shmid2);
     a1 = (float *) create_memory(4*size,&amp;shmid4);
     b1 = (float *) create_memory(4*size,&amp;shmid5);
     ab = (float *) create_memory(4*size,&amp;shmid6);
     mean1 = (float *) create_memory(4,&amp;shmid7);
     mean2 = (float *) create_memory(4,&amp;shmid8);
     bar = (int *) create_memory(2*4,&amp;shmid3);
  
     for(i=0;i&lt;size;i++)        
     {
           printf("Enter %d Element of x : ",i+1);
           scanf("%d",&amp;a[i]);
           printf("Enter %d Element of y : ",i+1);
           scanf("%d",&amp;b[i]);  
     }
     printf("Enter the no of process : ");
     scanf("%d",&amp;nproc);
     barrier_init(bar,nproc);
     sum1=0;
     sum2=0;
     pid=create_process(&amp;nproc);
     for(i=pid;i&lt;size;i+=nproc)
     {
           sum1 = sum1 + a[i];
           sum2 = sum2 + b[i];
     } 
     barrier(bar);
  
     (*mean1) += (float)sum1/size;
     (*mean2) += (float)sum2/size;
  
     barrier(bar);
     for(i=pid;i&lt;size;i+=nproc)
     {    
           a1[i] = (a[i])-(*mean1);
           b1[i] = (b[i])-(*mean2);
     }
     for(i=pid;i&lt;size;i+=nproc)
     {    
           ab[i] = a1[i]*b1[i];
     }
     join_process(&amp;nproc,&amp;pid);
     for(i=0;i&lt;size;i++)
     {
           total = total+ab[i];
     } 
     printf("The Correlation is : %f \n",total);
     if(total &gt;= 0)
           printf("The Correlation  is Positive\n"); 
     else  
           printf("The Correlation is Negative \n");
     cleanup_memory(&amp;shmid1);
     cleanup_memory(&amp;shmid2);
     cleanup_memory(&amp;shmid3);
     cleanup_memory(&amp;shmid4);
     cleanup_memory(&amp;shmid5);
     cleanup_memory(&amp;shmid6);
     cleanup_memory(&amp;shmid7);
     cleanup_memory(&amp;shmid8);
     return 0;              
  
     }  
  </code></pre>
  
  <p>here the header files such as Forkjoin and barrier are not able to be located.</p>
  
  <p>Thanks
  Abhinav</p>