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

Eigen Map MatrixXd to double** C++?

Tags: None
(comma "," separated)
gizzaa
Registered Member
Posts
3
Karma
0
OS

Eigen Map MatrixXd to double** C++?

Sat Mar 03, 2012 9:29 pm
Hi there
I would appreciate if someone's got spare time to help me with this.
example:
double **spektr=mojafinkcija(ime,&Xs,&Yx,&duration);
Map<MatrixXd> matrica(*spektr,Xs,Yx);

no errors until now.. same pointer address on both of them spektr and matrica.

when I try to make loop and list the values from **spektr and matrica(cout<<matrica(i,j)<<spektr[i][j] I get strange errors. sometimes it comes with out of range errors,sometimes strange values.. I have tried all the usual things change the rows columns.. transpose first.. nothing makes sense, is this a bug?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Eigen::Map is to map a one dimensional array that will be addressed like this: data{i+j*rows]. In tour case you have an array of arrays, which is a totally different storage format that is not supported by Eigen (because it is not memory efficient).
gizzaa
Registered Member
Posts
3
Karma
0
OS
thanks for taking time to answer.
since I am aware of this I will not try again :)

in your own opinion what's the best way when dealing with ** returns from external functions(representing images)
..in eigen of course.
thanks again
linello
Registered Member
Posts
56
Karma
0
OS
I think
Code: Select all
&matrix.data()
; is the way to represent a
Code: Select all
double **
, am I wrong?
gizzaa
Registered Member
Posts
3
Karma
0
OS
Thanks:)


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]