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 17:11:44 -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=o/Sl4NAlncpPImyLh5l3xZNZCUj71zPYh77DuPmbCWk=; b=ZiypFUUGT13yJ0jZ8oNzSNjWcfOUEE/3F9bTpp5UasK9JFb4fX80N+5aAHfiq+tFOp NnE7FYq2kB5+8+73bMcmIozc7JSfGCxvOi2FdxBaRvyVHM0aCBTNuDUtpjxfsYNr7gKw NT23vFIjS9YoaBjqIi2xqCOCaaZnZ8bdytovs=
- 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=tew7AaKp/GE6g80gUK2Nvqze15D3abbmzlKH/49R1kRnCh2Q9hckw4Xp9TOJmKiBo0 34NETzVr8q+zQDRt43yXp5oDrWUcGmduJZs4gPJ2XSD8ptDfcYERpu2LL1hfXMAD1wzI MshuwxDI9jYBQYOPLH31QoU5O/wPDVfvqP/ZM=
Thanks, pushed to the default branch.
Do you need it in 2.0?
Benoit
2010/1/7 Trevor Irons <trevorirons@xxxxxxxxx>:
> Patch attached.
>
> Thanks,
>
> Trevor
>
>
> 2010/1/7 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
>>
>> 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
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>