Parameterizing a Correlation Matrix

Use a Spectral Decomposition method to parameterize a correlation matrix [Rebonato1999]. The input of the algorithm is a matrix that resembles a correlation matrix but lacks the property of positive semi-definiteness. The output of the algorithm is a parameterized correlation matrix with non-negative eigenvalues.

Summary Statistics supports two usage models for parametrizing a correlation matrix:

  1. The dataset and its parameters are provided into the library through a constructor or editors of the Summary Statistics. The correlation matrix for this dataset is computed using the approaches described above. Parameterization of the correlation is performed with the method of Spectral Decomposition.

  2. The correlation matrix computed earlier using Summary Statistics algorithms or other tools is simply registered in the Summary Statistics task. The dimension of the task defines the order of the matrix. In this case, you do not need to provide the dataset and its attributes such as number of observations and its storage format to the library.

The example below illustrates the second parameterization model:

#include "mkl_vsl.h"
#define DIM 3     /* dimension of the task */
 
int main()
{
    VSLSSTaskPtr task;
    MKL_INT p;
    MKL_INT corstorage, pcorstorage;
    int status;
    float cor[DIM*DIM], pcor[DIM*DIM];
 
    p = DIM;
    corstorage  = VSL_SS_MATRIX_STORAGE_FULL;
    pcorstorage = VSL_SS_MATRIX_STORAGE_FULL;
 
    /* Create a task */
    status = vslsSSNewTask( &task, &p, 0, 0, 0, 0, 0 );
 
    /* Register arrays for parameterization of the correlation matrix */ 
    status = vslsSSEditCorParameterization( task, cor, &corstorage, 
                                            pcor, &pcorstorage );
    /* Compute a task */
    status = vslsSSCompute( task, VSL_SS_PARAMTR_COR, VSL_SS_METHOD_SD );
 
    /* Delete the task */
    status = vslSSDeleteTask( &task );
 
    return 0;
}

 

Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.