5

I want to use lapack and make C++ matrix wrapper for it, but lapack is written in Fortran, there are some clapack but I want to use it from source. compile firstly *.f and *.cpp files to object files then link it into a application..

the following apps and sources that I have.

  • visual studio proff edition,dev c++,ultimate++,mingw whatever
  • g95 and gfortran (under mingw) compiler
  • lapack (latest source)
  • blas (included in lapack)

How can I make an application please help...

My Operating System is Windows 7 and CPU Core2Duo and I dont have Intel math kernel

CharlesB
  • 86,532
  • 28
  • 194
  • 218
nurmurat
  • 151
  • 1
  • 11

1 Answers1

3

You can use the official C bindings for LAPACK, and then build your C++ wrapper around that. That avoids the issue of having to worry about the Fortran calling conventions, and the C bindings are a bit friendlier for C/C++ programmers than calling the Fortran routines directly.

Additionally, you could use one of the C++ matrix libraries that are already available, instead of rolling your own. I recommend Eigen.

PS.: Eigen matrices/vectors have a data() member that allows calling LAPACK without having to make temporary copies.

janneb
  • 36,249
  • 2
  • 81
  • 97
  • You can also try [Armadillo](http://arma.sourceforge.net), which is an efficient C++ wrapper for LAPACK (and BLAS). Like Eigen, it also uses expression templates for speed. However, Armadillo differs from Eigen in that its syntax (API) closely resembles Matlab. – mtall Dec 18 '12 at 10:19