Ch LAPACK for C LAPACK bindings

Ch Professional Edition supports all C LAPACK functions. /* This C program uses C LAPACK function dgeev_() to calculate engenvalues in double data type. The program is readily run in Ch interpretively without compilation. */ #include <stdio.h> #include <f2c.h> #define SIZE 3 int main( ) { char jobvl = 'V'; char jobvr = 'N'; long int n = SIZE; double a[SIZE][SIZE] = {1., 3., 1., 0., 4., 5., 0., 0., 9.}; long int lda = SIZE; double wr[SIZE]; double wi[SIZE]; double vl[3*SIZE]; long int ldvl = SIZE; double vr[3*SIZE]; long int ldvr = SIZE; double work[4*SIZE]; long int lwork = 4*SIZE; long int info; double b[3][3]; int i, j, nn=3, mm = 3; for(i=0; i<nn; i++) for(j=0; j<mm; j++) b[i][j] = a[j][i]; /* Subroutine int dgeev_(char *jobvl, char *jobvr, integer *n, real *a, integer *lda, real *wr, real *wi, real *vl, integer *ldvl, real *vr, integer *ldvr, real *work, integer *lwork, integer *info) */ dgeev_(&jobvl, &jobvr, &n, b, &lda, wr, wi, vl, &ldvl, vr, &ldvr, work, &lwork, &info); printf(" INFO=%d\n", info ); for ( i= 0; i< SIZE; i++ ) { printf("WR[ %d ] = %f\n", i, wr[ i ]); } return 0; }
The output is:
INFO=0
WR[ 0 ] = 1.000000
WR[ 1 ] = 4.000000
WR[ 2 ] = 9.000000