Alex Rivera | Logout

System of linear equations in C++?

Asked 2010-03-19T01:22:56.503
14

I need to solve a system of linear equations in my program. Is there a simple linear algebra library for C++, preferably comprised of no more than a few headers? I've been looking for nearly an hour, and all the ones I found require messing around with Linux, compiling DLLs in MinGW, etc. etc. etc. (I'm using Visual Studio 2008.)

Edit
Report

1 Answer

2

I am a big fan of Armadillo but your compiler may be an issue here according to the the end of the download page:

Windows

The development and testing of Armadillo has so far been done mainly on UNIX-like platforms, however there should be little or no platform specific code. While rudimentary tests were done on a Windows machine, the developers are interested in hearing how well Armadillo works in more thorough tests.

If you're having trouble with the 'MS Visual C++ 2008 Express Edition' compiler (due to its incomplete support for the C++ standard), you may want to try the following alternative free compilers:

  • Intel's C++ compiler
  • GCC (part of MinGW)
  • GCC (part of CygWin)

It is worth trying out as this is a well-designated (and mostly templated) library.

Otherwise, maybe try Eigen2 which lists your compiler as supported.

Edit: In response to the comment, Armadillo does not require Lapack but works better with it (and better still with tuned Blas):

Q: What other libraries do I need to make full use of Armadillo ?
A: Armadillo can work without external libraries. However it is recommended to install the LAPACK and ATLAS libraries in order to get added functionality. Armadillo will use ATLAS routines in lieu of LAPACK wherever possible.

Q: How well will Armadillo work without LAPACK/ATLAS ?
A: Basic functionality will be available (e.g. matrix addition and multiplication), but things like eigen decomposition will not be. Matrix multiplication (mainl

answered 2010-03-19T01:30:11.553

Your Answer