This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Using GSL routines with the Eigen Library

Tags: None
(comma "," separated)
grekop
Registered Member
Posts
10
Karma
0
I have some matrices in Eigen data types format and I want to use them in a GNU Scientific Linrary routines.
Specifically I want to use the routines for 15.6 Real Generalized Nonsymmetric Eigensystems
that are here:
http://www.gnu.org/software/gsl/manual/ ... stems.html
I would appreciate any advice on how to feed GSL routines with Eigen matrixes.
Thank you
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Eigen matrices are stored contiguously, without any padding/stride or anything complicated. Column-major by default, but you can change that. So it should be trivial to pass them to GSL routines. To get a pointer to the array of coefficients of a matrix, call .data()


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
grekop
Registered Member
Posts
10
Karma
0
Thank you very much.GSL uses row major when storing arrays in the memory?
User avatar
bjacob
Registered Member
Posts
658
Karma
3
No idea, look at their documentation. If you want row-major with Eigen, do for example: Matrix<float,Dynamic,Dynamic,RowMajor>


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
grekop
Registered Member
Posts
10
Karma
0
Thanks. I ll post when I find any convenient tip on using GSL with Eigen
grekop
Registered Member
Posts
10
Karma
0
Well I think it's rather simple...
We declare the matrix with RowMajor mode
Eigen::Matrix<double,30,30,Eigen::RowMajor> A;

and we declare the GSL matrix:
gsl_matrix_view Agsl = gsl_matrix_view_array (A.data(), 30, 30);

I tested it and hope that's it!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]