|[eigen] Assignment of Complex Number|
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
It might be an easy task for you guys, but I couldn't figure it out by myself.
I am hoping one of you can help me on my problem.
I define a complex double vector, but I am not able to assign a value to both real and imaginary part of an element in that vector.
Here is an example of what I do.
Please show me a way to complete this simple task.
using namespace Eigen;
using namespace std;
// Imagine these are my data vectors
// First one is real part
// second one is imaginary part
VectorXd FirstVector = VectorXd::Ones(10);
VectorXd SecondVector = VectorXd::Ones(10);
// Define a Complex Vector with same size
VectorXcd ComplexVector = VectorXcd::Zero(10);
// Fill Complex Vector from data Vectors
for (int i = 0; i < 10; i++)
ComplexVector(i) = (FirstVector(i), SecondVector(i));
// I was expecting to see 1+i1 as a value of Complex Vector elements
cout << " Complex Vector : \n " << ComplexVector << endl;
-- Gokturk Poyrazoglu Mitsubishi Electric Research Laboratories (MERL) 201 Broadway, Cambridge, MA
|Mail converted by MHonArc 2.6.19+||http://listengine.tuxfamily.org/|