Programming libraries for C linear algebra

Click For Summary

Discussion Overview

The discussion revolves around the search for freely available C or C++ libraries capable of calculating eigenvalues and eigenvectors for generalized eigenvalue problems, specifically of the form Au = LBu, where A and B are matrices, L is the eigenvalue, and u is the eigenvector. The scope includes recommendations for libraries, installation experiences, and issues encountered during usage.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about libraries for generalized eigenvalue problems, noting that the GNU Scientific Library only handles standard eigenvalue problems.
  • Another participant suggests CLAPACK and mentions other resources like BLAS and Numerical Recipes, indicating that they may not directly address eigenvalue calculations.
  • A later reply confirms that CLAPACK is suitable for the task and provides links for downloading and documentation, while also mentioning the challenges of installation and the need to understand matrix storage in memory.
  • Another participant shares their experience with CLAPACK on a Mac, reporting an issue with the dgesv_() routine failing to detect a singular matrix in a specific case, and invites others to test the same scenario.

Areas of Agreement / Disagreement

Participants generally agree that CLAPACK can be used for generalized eigenvalue problems, but there is disagreement regarding its reliability in detecting singular matrices, as evidenced by the reported issue with the dgesv_() routine.

Contextual Notes

The discussion highlights limitations in the libraries mentioned, particularly regarding their capabilities with singular matrices and the potential for installation difficulties. There are also unresolved questions about the accuracy of solutions provided by CLAPACK.

Who May Find This Useful

This discussion may be useful for programmers and researchers interested in linear algebra computations in C or C++, particularly those looking for libraries that handle generalized eigenvalue problems.

odiakkoh
Messages
8
Reaction score
0
Hi,

Can anyone recommend a freely available library in C or C++ that is able to calculate eigenvalues and eigenvectors of generalized eigenvalue problems. e.g. of the type:

Au = LBu

where A and B are matrices, L is the eigenvalue, and u is the eigenvector.

N.B. the GNU Scientific library was my first thought, but it can only do standard eigenvalue problems, not those of the generalized type.
 
Physics news on Phys.org
blas doesn't have eigenvalue stuff?. BUt you can try CLAPACK and maybe look at lidia. you can tyr to find some at netlib.org.

Or you can try numerical recipes code(usually for teaching purposes but still usable).
www.nr.com.
 
CLAPACK does the job

Thanks a lot! - CLAPACK does the job.

For anyone else interested in doing matrix-type algebra in C here's some useful CLAPACK links:

CLAPACK can be downloaded from here: http://www.netlib.org/clapack/
Documentation can be found here: http://www.netlib.org/lapack/lug/index.html

Explanations for function parameters are found in the code.


It's a bit fiddly to install, and link to the libraries (all three of them) bundled in the package. The interface will feel quite archaic to anyone accustomed to the niceities of object orientated languages (such as myself). But it does do the job.

Oh, and one last hint for anyone trying to use this: take note of the documentation explaining how matrices are stored in memory: particularly in what order array elements correspond to matrix elements. I didn't bother; made an assumption; got it wrong (damn! I had a 50:50 chance!), and spent a few hours wondering why things weren't working quite right!
 
Hey, guys, I installed CLAPACK on my Mac without much trouble. However it failes on solving this simple equation Ax = b, where A is singular, yet the routine dgesv_() didn't detect it. Can you test the case on you machine? Here is the input.

Matrix:
-10.0 -5.0
6.0 3.0

Vector:
0 0.000000
1 1.000000

info = 0

Solution from CLAPACK:
0 1125899906842624.000000
1 -2251799813685248.000000
 

Similar threads

  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 44 ·
2
Replies
44
Views
5K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K