Registered Member
|
Hi,
I'd like to perform a dot/cross product between a Vector3d and a Vector3cd, but the code won't compile. Should I cast Vector3d into Vector3cd? But then I would lose efficiency in addition to casting, since: 1) complex times real = 2 real multiplications 2) complex times complex = 4 real multiplications Maybe the code doesn't compile due to wrong headers? Or the code isn't implemented (in which case I would be happy to write the corresponding short piece of software, since I really need it). Any help much appreciated! |
Moderator
|
indeed currently this is forbidden, though we have all the logic for that. In the meantime for the dot product you can do:
a.adjoint() * b and for the cross product you'll have to use cast<std::complex<double> >. I'll try to fix it asap. |
Moderator
|
done for the dot() function.
|
Registered Member
|
Thanks! That was a quick one!
|
Moderator
|
done for the cross product too.
btw, the cross product function was not correct for complexes. I also fixed that. |
Registered Member
|
Is it an efficient multiplication, meaning: double times complex? Or is it casting of the doubles to complex, then multiplying?
Oh, and is it ok for Vector3f and Vector3cf as well? Thanks for the speedy implementation! |
Moderator
|
there is no conversion, and yes this works for float and any other numeric types.
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft