Cholesky

Table of Contents

Note
This tool is part of the GAMS Tools Library. Please inspect the general information about GAMS Tools.

This calculates the Cholesky decomposition of a symmetric positive definite matrix A: A = LLt The matrix A is indexed over A(i,i).

Usage

Command line:

gamstool [linalg.]Cholesky i A L gdxIn=fileIn.gdx gdxOut=fileOutgdx

Compile time:

$callTool [linalg.]Cholesky i A L [gdxIn=fileIn.gdx] [gdxOut=fileOutgdx]

Execution time:

executeTool '[linalg.]Cholesky i A L [gdxIn=fileIn.gdx] [gdxOut=fileOutgdx]';

Where:

Argument Description
i Name of set used in matrix i(*).
A Name of two-dimensional matrix parameter A(i,i).
L Name of two-dimensional parameter containing the factor L(i,i).

The following named parameters are available:

Parameter Description
gdxIn=fileIn.gdx Name of GDX file that contains symbols i and A. Mandatory if called from the command line, otherwise optional.
gdxOut=fileOut.gdx Name of GDX file that contains symbol L after execution. Mandatory if called from the command line, otherwise optional.


Examples

executeTool.checkErrorLevel 'linalg.cholesky n Yl L';
* Check if Cholesky factorization is correct
Parameter Y_, Ydiff;
Y_(i,j)    = sum(n, L(i,n)*L(j,n));
Ydiff(i,j) = round(Y.l(i,j) - Y_(i,j),1e-6);
option Ydiff:8:0:1;
abort$card(Ydiff) Ydiff;

For the complete example, see model [Maxcut] in the GAMS Model Library.

execute_unload 'a.gdx', i, a;
executeTool.checkErrorLevel 'linalg.cholesky i a L gdxin=a.gdx gdxout=b.gdx';
execute_load 'b.gdx', L;
$callTool linalg.cholesky i a L;