Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

VSL questions

$
0
0

Hi, I am using MKL 11.0 update 3 on Windows 7,core i7 machine.
1. Invalid correlation matrix ?
 #define N 2
 #define DIM 2
 void Test()
 {
    VSLSSTaskPtr task;     MKL_INT dim = DIM, n=N;
    MKL_INT x_storage=VSL_SS_MATRIX_STORAGE_COLS;
    MKL_INT cov_storage=VSL_SS_MATRIX_STORAGE_FULL,cor_storage=VSL_SS_MATRIX_STORAGE_FULL;
    double x[N][DIM],mean[DIM], cov[DIM][DIM], cor[DIM][DIM];
    double raw2[DIM], raw3[DIM], raw4[DIM],cen2[DIM], cen3[DIM], cen4[DIM];
    int i, j, errcode;     unsigned MKL_INT64 estimate = 0;
    x[0][0] = 2; x[0][1] = 3;
    x[1][0] = 4; x[1][1] = 2;
    errcode = vsldSSNewTask( &task, &dim, &n, &x_storage, (double*)x, 0, 0 );
    errcode = vsldSSEditMoments( task, mean, raw2, raw3, raw4,cen2, cen3, cen4 );
    errcode = vsldSSEditCovCor( task, mean, (double*)cov, &cov_storage ,(double*)cor, &cor_storage );
    estimate = VSL_SS_MEAN | VSL_SS_2R_MOM | VSL_SS_3R_MOM | VSL_SS_4R_MOM |
               VSL_SS_2C_MOM | VSL_SS_3C_MOM |VSL_SS_4C_MOM |VSL_SS_COV | VSL_SS_COR;
    errcode = vsldSSCompute( task, estimate, VSL_SS_METHOD_FAST );
    printf("\n Computed covariance matrix  Computed correlation matrix\n");
    for(i = 0; i < dim; i++) {
        for(j = 0; j < dim; j++) {
            printf(" %+9lf ", cov[i][j]);
        }
        printf("            ");
        for(j = 0; j < dim; j++) {
            printf(" %+9lf ", cor[i][j]);
        }
        printf("\n");
    }
    errcode = vslSSDeleteTask( &task );
 }
 Results of the program above follows:
  Computed covariance matrix  Computed correlation matrix
  +2.000000  -1.000000              +2.000000  -1.000000
  -1.000000  +0.500000              -1.000000  +0.500000
 Why is covariance matrix and correlation matrix the same ?

2.Variance confusing ?
 In documentation, "Mathematical Notation and Definitions" defines  "central moments of the third and the fourth order" and "variance" of freedom n-1.  The central moments of the 2nd order(which is not defined in the manual) is  the variance of freedom n in general. But it can be specified in  vslSSEditMoments  by c2m which actually returns variance of freedom n-1(not the central moments of  the 2nd order).
#After repeating same computation,c2m(only) occasionally become NaN(racing condition?),   but it's not always...

3. In All MKL examples for random numbers(vdrnggaussian.c etc),can DeltaM and DeltaD be negative ?
   Is there any intension or theoretical backbone for not using absolute values ?
   Could someone kindly tell me the meaning of DeltaD which seems to be some expansion but I cannot    derive it...

4. http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/index.htm
   vslSSEditSums & vslEditCP go "404 Not Found".


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>