Page 1 of 1

CLAPACK dtrexc_ function not working

PostPosted: Thu Aug 12, 2010 1:57 pm
by unadulterated
I am following a fortran program to check whether the dtrexc_() is working or not. UNfortunately, its not working, please refer the link below.

http://docs.google.com/viewer?a=v&q=cache:vUrcmZ9777sJ:www.nag.com/numeric/fl/manual20/pdf/F08/f08qff.pdf+dtrexc+info+%3D+1&hl=en&gl=us&pid=bl&srcid=ADGEESjzsYF639LVz0Krx1xLC8tNUoqwDcl93KGDFF7V2lIHVcMBsC3hlf1TCM1w65AP6KKb92ARl8tvOuetLDwq0B6hRodun7LepNhPhT-qGxnDvIANfdYCWkdv5ZOEqAHLUu7Rj2cr&sig=AHIEtbT2hxbdhCB-1gtrcR8vGxqWHA04zA

I coded the program in c. (the example in the above pdf.. towards the end)

Code: Select all
#define SIZE 4
#define TRUE 1

main()
{
    int i, j;
    integer N = SIZE;
   
    integer LDA = N;
    integer INFO;
    real a[SIZE*SIZE] = {0.80,  0,    0,    0,
                         -0.11, -.10, -.65, 0,
                         0.01 , 0.25, -0.1, 0.0,
                         0.03,  0.35, 0.2, -.1};
    real wk[201];
   
    integer LDVS = 1;
    real vs[1*1];

    FILE *fp;
    fp = fopen("schurDecomposition.txt","w");
   
    // printing the schur form (given)
    for ( i= 0; i< SIZE; i++ )
    {
        for ( j= 0; j< SIZE; j++ )
            fprintf(fp,"%0.4f\t", a[i+SIZE*j]);
        fprintf(fp,"\n");
    }
    fprintf(fp,"\n");

    char compq = 'N';
    integer ilst = 1;
    integer ifst = 2;

    strexc_(&compq, &N, a, &LDA, vs, &LDVS, &ifst, &ilst, wk, &INFO);
   
    printf("INFO = %ld\n", INFO);
   
    // printing the schur form after re-ordering
    for ( i= 0; i< SIZE; i++ )
    {
        for ( j= 0; j< SIZE; j++ )
            fprintf(fp,"%0.4f\t", a[i+SIZE*j]);
        fprintf(fp,"\n");
    }
   
    fclose(fp);

    return 0;
}


The code is running but is not able to do the required thing, i.e shift the 1st eigen value to the 2nd one... as depicted in the fortran example pdf (towards the end). INFO = 1.. is coming

The fortran example shows it works for them, but for me with the same inputs its not working.
I think this is a very simple problem, but unfortunately I am doing some mistake, please help me solving this.

Re: CLAPACK dtrexc_ function not working

PostPosted: Thu Aug 12, 2010 3:08 pm
by unadulterated
The dtrexc_() function of CLAPACK does not seem to work when eigen values are coupled (although depicted in fortran LAPACK example that it works).

Please let me know if there is something else in the inputs.

Sandip

Re: CLAPACK dtrexc_ function not working

PostPosted: Thu Aug 12, 2010 3:11 pm
by unadulterated

Re: CLAPACK dtrexc_ function not working

PostPosted: Thu Aug 12, 2010 4:34 pm
by jteg68
I tried the fortran and your C example and got identical results as on the nag site.
Did you send the actual code you compiled, and what was your compile and linking command?

/Jörgen