Eigenvalue

Table of Contents

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

This calculates the Eigenvalues of a symmetric positive definite matrix. The matrix A is indexed over A(i,i). AVal(i) is indexed over i.

Usage

Command line:

gamstool [linalg.]Eigenvalue i A AVal gdxIn=fileIn.gdx gdxOut=fileOut.gdx

Compile time:

$callTool [linalg.]Eigenvalue i A AVal [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]

Execution time:

executeTool '[linalg.]Eigenvalue i A AVal [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]';

Where:

Argument Description
i Name of set used in matrix i(*).
A Name of two-dimensional matrix parameter A(i,i).
AVal Name of one-dimensional parameter to store the Eigenvalues AVal(i).

The following 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 AVal after execution. Mandatory if called from the command line, otherwise optional.


Example

set i /i1*i3/;
alias (i,j);

table a(i,j)
         i1   i2   i3
   i1     9    1    1
   i2     1    9    1
   i3     1    1    9

;

parameter e(i) 'eigenvalues';

execute_unload 'a.gdx', i, a;
executeTool.checkErrorLevel 'linalg.eigenvalue i a e gdxin=a.gdx gdxout=b.gdx';
execute_load 'b.gdx', e;
abort$(abs(e('i1')-8)>1e-3 or abs(e('i2')-8)>1e-3 or abs(e('i3')-11)>1e-3) 'Wrong Eingenvalues', e;

option clear=e;
executeTool.checkErrorLevel 'linalg.eigenvalue i a e';
abort$(abs(e('i1')-8)>1e-3 or abs(e('i2')-8)>1e-3 or abs(e('i3')-11)>1e-3) 'Wrong Eingenvalues', e;