Introduction

Here you can download a C wrapper for LAPACK.

The goals of this package are to take care of type compatibilities among languages and to expose to the user an interface that looks native in his programming language. To put it simply, the philosophy is that the user should not 'feel' the library language.

Hopefully, this package can someday be part of the official LAPACK release or at least help LAPACK moving in this direction.

Installation

0) Edit make.inc to fit your system
   Important things to change are :
    - ROOT_DIR : where make.inc is
    - BLASLIB : the blas library
    - LAPACKLIB : the lapack library
    - CBLASLIB : the cblas library
    - INCLUDE : you need to point to the cblas source directory. If you do not want to build the examples, just leave it blank.
    - LASRCDIR : lapack source directory, used by the script that generates the wrapper

1) Generate the c wrapper
    make source

    This will generate the .c files for every lapack function in src, and the .h in include. Will also generate the testing wrapper code in testing (more below).

2) Compile the c wrapper
    make library

    This will build lapack_wrapper.a in lib.

3) Compile and execute the test program
    make test

    This will build libtesting_wrapper_wrapper.a in testing, and execute
the testing program.
	

Downloads :

  • lapwrapc_0.9.tar.gz (09/12/2009) : the C wrapper. It comes with source files and a testing suite. Please read the README included in the archive.
  • Usage

        To use the LAPACK c wrapper, just link your program with the lapack_wrapper.a library in the lib directory. 
    The function names of the c functions are the name of the lapack routines, lowercase, with lapack_ 
    in front of them (so, DGESV will be called by lapack_dgesv). The parameters obey the following rules :
        - complex and complex*16 are respectively, arrays of size 2 of float or double.
        - scalar input parameter that are not complex are passed by value. Other parameters are passed by adress.
        - A parameter that is a LOGICAL in Fortran is a long int in C. Just set it to 1 or 0, for .TRUE. or .FALSE. .
    
        If in any doubt, just have a look at the lapack_function.c, where function is the name of the subroutine you want to call.
     The code is really straightforward.
    	

    Examples

    Documentation

    presentation_wrapper_C.pdf: the slides on the C wrapper used during the talk at ICL, on the 03/17/2006. May contain some useful information on the choices that were made, and on how things work.