// Example file for nag_intext3 which demonstratest the
// linking of nag_complex_eigensystem_sel (f02gcc) into Scilab

crit = 'm';
n = 4;
a =  [-3.97 - %i*5.04 -4.11 + %i*3.70 -0.34 + %i*1.01  1.29 - %i*0.86;
       0.34 - %i*1.50  1.52 - %i*0.43  1.88 - %i*5.38  3.36 + %i*0.65;
       3.31 - %i*3.85  2.50 + %i*3.45  0.88 - %i*1.08  0.64 - %i*1.48;
      -1.10 + %i*0.82  1.81 - %i*1.59  3.25 + %i*1.33  1.57 - %i*3.44 ];
wl = -5.5;
wu = 5.5;
mest = n;

eig_exp = [ -5.0000 + %i*2.0060;
             3.0023 - %i*3.9998];

tol = 1.0e-4;


// Eigenvectors expected
//              1              2
// 1  ( -0.3865,   0.1732)  ( -0.0356,  -0.1782)
// 2  ( -0.3539,   0.4529)  (  0.1264,   0.2666)
// 3  (  0.6124,   0.0000)  (  0.0129,  -0.2966)
// 4  ( -0.0859,  -0.3284)  (  0.8898,   0.0000)

[w,v,m,ifail] = nag_cmplx_eisys_sel_fun(crit,n,a,wl,wu,mest)


 ok1 = abs(w(1) - eig_exp(1))/abs(eig_exp(1)) < tol
 ok2 = abs(w(2) - eig_exp(2))/abs(eig_exp(2)) < tol

 if ~ok1; write(%io(2),'Error in expected output'); end;
 if ~ok2; write(%io(2),'Error in expected output'); end;

