I am a newbie to LAPACK, so please forgive my ignorance on some topics.
I want to use LAPACK by Visual C++ 2010 under Windows, and I have consulted some material from internet, but also got some confuse. From my consult, there are some different ways to use LAPACK under Windows:
Method 1: direct invoke LAPACK routine frome C/C++ source code. Because LAPACK was writted by FORTRAN, and its native interface was in FORTRAN, so some modification on C/C++ is needed.
For example, the original dgesv routine in Fortran is:
- Code: Select all
subroutine DGESV ( INTEGER N,
INTEGER NRHS,
DOUBLE PRECISION, dimension( lda, * ) A,
INTEGER LDA,
INTEGER, dimension( * ) IPIV,
DOUBLE PRECISION, dimension( ldb, * ) B,
INTEGER LDB,
INTEGER INFO
)
In C/C++ code, an underscore should be added:
- Code: Select all
void dgesv_(const int *N, const int *nrhs, double *A, const int *lda, int
*ipiv, double *b, const int *ldb, int *info);
For convenience, we can use f2c's type conversion:
- Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
#include "f2c.h"
int dgesv_(integer *n, integer *nrhs, doublereal *a, integer *lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);
#ifdef __cplusplus
}
#endif
Method 2: using CLAPACK (f2c'ed version of LAPACK). As I understanding, the statement "f2c'ed version of LAPACK"
means converting all LAPACK FORTRAN source code to C source code by f2c utility. In "clapack.h" header file, the FORTRAN subroutine dgesv prototype is:
- Code: Select all
int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
*lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);
Method 3: I just found that LAPACK has a C interface in the lapacke directory, but I do not know can this
interface be used under Windows? And if it can be used, how?

