Different ways to use LAPACK under Windows

Post here if you have a question about linking your program with LAPACK or ScaLAPACK library

Different ways to use LAPACK under Windows

Postby panovr » Fri Dec 23, 2011 8:59 am

Hi,
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?
panovr
 
Posts: 4
Joined: Mon Dec 19, 2011 9:47 am

Re: Different ways to use LAPACK under Windows

Postby admin » Fri Jan 13, 2012 5:08 pm

Method 3 is available under Windows now.
It is still experimental, but it should work nonetheless.
Please see http://icl.cs.utk.edu/lapack-for-window ... k/#lapacke
Let mw know how it goes
Julie
admin
Site Admin
 
Posts: 498
Joined: Wed Dec 08, 2004 7:07 pm


Return to Linking Problem

Who is online

Users browsing this forum: No registered users and 0 guests