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

Product of Mapped vectors (Real x Complex)

Tags: None
(comma "," separated)
rbossart
Registered Member
Posts
14
Karma
0
Hi,

I'd like to compute the inner product of two Mapped vectors : one vector is made of T [T=double], the other is made of std::complex<T>, but Eigen does not like it. It cannot cast the result to a std::complex<T>.

Is it something planned ?

Cheers
Romain


rbossart, proud to be a member of KDE forums since 2008-Dec.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Works for me:

Code: Select all
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
  double da[10];
  std::complex<double> db[10];
  Map<VectorXd> a(da,10);
  a.setRandom();
  Map<VectorXcd> b(db,10);
  b.setRandom();
  std::complex<double> res1 = a.transpose() * b;
  std::complex<double> res2 = a.dot(b);
}
rbossart
Registered Member
Posts
14
Karma
0
And it works! Thanks Gaël.
(I was using the res = X*B notation, but with 'dot', it works perfectly)

By the way, in 3.1.0 alpha2, the speed improvement for product of small dynamic matrices is *impressive*.
For my problems, I get a 30% improvement over 3.0.5, which was already fast.
Many thanks

Romain


rbossart, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell