Re: [eigen] MathFunctions.h patch |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] MathFunctions.h patch
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 7 Jan 2010 16:54:15 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=zx53E4TqwzRd74GVFxH+sJJwaa3/s1MRLEYeJWkwY34=; b=L4C+GtVKOLr+YvKTiiV7VNLAc9wrb6R0AkjCzVsqrVdu5JqZaqX4hTVoyFMifPWe4V 2bWamcu6T/5k+ZDSYmcBUEJOvUeWyGOSUmqLAvvHl4ekITMluSVQPtnIpmG2BSKZz7DR oa0YXEZoC8EtiOGiw7i6DyCZ7lwe24MNNis0c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=wAsVVRxG7WPNab1y2Ot/lC+xQ1mvpapho5E0vJ6MzDF92Y9mgBKeGp1XHV2emR94KC dAIun5z36CxZMp1Gcinn4E/ni6qVoC/edBGPoVnqXYfkYqCweqijw3ZIiqbja+JQ0cBS tr9bn8jxOZxvm6RPJyLud4qDH56pqxTQZFbyM=
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
>> >
>>
>>
>
>