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

How to initialize complex number matrix?

Tags: None
(comma "," separated)
longflying
Registered Member
Posts
2
Karma
0
Hi ,

In the Eigen doc , only initialization of real number matrix is mentioned, but how do I initialize complex number matrix with "<<"?
The real matrix case :
Matrix3f m;
m << 1, 2, 3,
4, 5, 6,
7, 8, 9;
std::cout << m
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
That's not related to Eigen, but to general C++. Use std::complex constructor, e.g.:

typedef std::complex<double> cd;
m << cd(2,3), cd(1.2,-45), ....;


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]