Estimating a Partial Variance-Covariance Matrix

Use the VSL_SS_FAST_METHOD method to compute a partial variance-covariance matrix.

For the definition of a partial variance-covariance matrix, see the Mathematical Notation and Definitions chapter in the Summary Statistics section of [MKLMan].

To calculate the matrix, provide a variance-covariance matrix and split the random vector ξ = (ξ1,...,ξ7) of dimension p into two non-overlapping sub-components, Υ and Ζ. Each component is encoded as follows:

, for all i = 1,...,p.

This partition defines the following structure of the variance-covariance matrix:

.

Partial variance-covariance is calculated as: P = CΥ - CΥΖCΖ-1CΖΥ.

The example below demonstrates computation of a partial variance-covariance matrix:

#include "mkl.h"
 
#define N          1000     /* number of observations */
#define DIM           4     /* dimension of the task */
#define PART_DIM (DIM/2)    /* dimension of partial variance-covariance */
 
int main()
{
    int i, j, status;
    VSLSSTaskPtr task;
    MKL_INT p, n, xstorage, covstorage, pcovstorage;
    double x[DIM][N];  /* matrix of observations */
    unsigned long long estimates;
 
    double mean[DIM], cov[DIM][DIM];
    MKL_INT p_index[DIM];
    double p_cov[PART_DIM][PART_DIM];
 
    p = DIM;
    n = N;
    xstorage    = VSL_SS_MATRIX_STORAGE_ROWS;
    covstorage  = VSL_SS_MATRIX_STORAGE_FULL;
    pcovstorage = VSL_SS_MATRIX_STORAGE_FULL;
 
    /* Splitting random vector into two components */
    for(i=0;i<DIM;i++)
    {
        p_index[i]=(i<PART_DIM)? 1 : -1;
        mean[i] = 0.0;
        for(j=0;j<DIM;j++) cov[i][j]=0;
    }
 
    for(i=0;i<PART_DIM;i++)
    {
        for(j=0;j<PART_DIM;j++) p_cov[i][j]=0;
    }
 
    /* Create a task */
    status = vsldSSNewTask( &task, &p, &n, &xstorage, x, 0, 0 );
 
    /* Initialize the task parameters */
    status = vsldSSEditCovCor( task, mean, cov, &covstorage, 0, 0 );
    status = vsldSSEditPartialCovCor( task, p_index, cov, &covstorage,
                                      0, 0, p_cov, &pcovstorage, 0, 0 );  
 
    /* Compute the variance-covariance and partial variance-covariance matrices */
    estimates = VSL_SS_COV | VSL_SS_PARTIAL_COV;
    status = vsldSSCompute( task, estimates, VSL_SS_METHOD_FAST );
 
    /* Deallocate the task resources */
    status = vslSSDeleteTask( &task );
 
    return 0;
}
Pour de plus amples informations sur les optimisations de compilation, consultez notre Avertissement concernant les optimisations.