Cholesky

Top  Previous  Next

CHOLESKY is a utility that calculates the Cholesky decomposition of a symmetric positive-definite matrix. where given the matrix A one finds the matrix L such that A=LL'.

It is used by using $Call or Execute on the command

 cholesky inputgdxfile indexofmatrix matrixtodecompose outputgdxfile resultantLmatrix

Where the parameters in this line are

 

inputgdxfile

Name of gdxfile sent to invert that has the matrix to be inverted

indexofmatrix

Name of set that defines row and column names of the matrix

matrixtodecompose

Name of the matrix to decompose that must be in inputgdxfile

outputgdxfile

Name of gdxfile  that has the resultant L matrix

resultantinverse

Name to call the L matrix in the gdx file outputgdxfile

 

Example choleskyexample.gms

Set index /i1*i2/;

Table a(index,index) matrix to decompose

             i1   i2

    i1       2     1

    i2       1     3;

parameter LforA(index,index) L matrix that is a decomposition of A;

execute_unload 'gdxforutility.gdx' index,A;

execute 'cholesky gdxforutility.gdx index A gdxfromutility.gdx LforA';

execute_load 'gdxfromutility.gdx' , LforA;

display a, LforA;