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

complex / real

Tags: None
(comma "," separated)
stuart-macg
Registered Member
Posts
18
Karma
0
OS

complex / real

Mon Feb 21, 2011 11:09 pm
I noticed that cpx-real operations are mentioned as supported in the beta 3.

I tried to use a complex vector expression divided by a real vector expression, but it was rejected with a message to use cast(). I could not find out how to do that, and it might not use efficient methods anyway?

I could Map a cpx N-vector to a 2xN real Array by using a cast on its data() pointer, and then do a colwise() (should that be rowwise() - I get confused) divide operation I suppose.

Is there anything nicer?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: complex / real

Wed Feb 23, 2011 1:31 pm
Indeed, we are probably missing a specialization for operator/. In the meantime the following should work (assuming arrays):

cplx_vec * real_vec.inverse();

which is an optimized version of:

cplx_vec / real_vec.cast<complex<double> >();


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft