Registered Member
|
The above code snippet shows a simple function to calculate (a/x+y) for the ArrayXXcd class. The program fails to compile with the error:
If instead, I try and compile the function with the usual SAXPY function == a*x+y, the code works perfectly fine. It appears that the division operator is not properly overloaded when complex types are mixed with reals. I have also tried the cast() method using .cast<std::complex<double>>() but I get a 'type does not exist error'. Can you suggest a work around? Thanks |
Moderator
|
|
Registered Member
|
Thanks gael!
Your suggestion works. However, I tried playing around with the expression. I run into the same problem when I try and calculate:
What do I do here? Is there a general way to make complex types play nice with real ones? |
Moderator
|
yes, it's currently limited to products. Again, no need to use a_array, complex<double>(a) + x + y should work. For an expression, a_array.cast<complex<double> >() will do the conversion.
|
Registered Member
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]