Re: [eigen] MathFunctions.h patch

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/1/7 Trevor Irons <trevorirons@xxxxxxxxx>:
> Ah, I was surprised, but understand.
>
> I am doing electromagnetic modelling, and this is necessary sometimes
> (often).
>
> From what I can tell std::sqrt returns the root in either the first or
> fourth quadrant of the complex plane, same as FORTRAN (I think).
> (Arbitrary, but useful for me)
>
> I can work around using for loops if you prefer not to include this in
> Eigen, but my *very* small vote would say to support it.
>
> I guess I don't really understand your argument fully. Is the behaviour of
> std::sqrt() for complexes not mandated by the C++ standard committee?  Or
> does this vary across compilers? If it is at least supposed to be
> consistent, then all you are doing is passing along expected behaviour of
> C++ to Eigen users, right?

Right, so, since you have a real use case, which is what I was trying
to filter for, let's go for it.
Could you just please generate a real patch:
 - configure your id
 - hg commit, write your commit msg
 - hg export tip
http://eigen.tuxfamily.org/index.php?title=Developer%27s_Corner#Generating_a_patch

Thanks
Benoit

>
> Thanks,
> -Trevor
>
>
> 2010/1/7 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
>>
>> It is on purpose that we excluded sqrt for complex numbers:
>>  - there is no canonical choice between the 2 determinations of the square
>> root.
>>  - no important use case was known to us.
>>
>> Do you have a use case?
>>
>> Benoit
>>
>> 2010/1/7 Trevor Irons <trevorirons@xxxxxxxxx>:
>> > Any problem adding the following patch, or something similiar, to
>> > MathFunctions.h to support std::complex<>.sqrt() ?
>> >
>> > 218d217
>> > < inline std::complex<float> ei_sqrt(std::complex<float>x)  { return
>> > std::sqrt(x); }
>> > 256d254
>> > < inline std::complex<double> ei_sqrt(std::complex<double>x)  { return
>> > std::sqrt(x); }
>> >
>> >
>> > -trevor
>> >
>>
>>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/