[no subject]

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


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?

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
> >
>
>
>

--0016367f956ccae08b047c99fe4b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Ah, I was surprised, but understand. <br><br>I am doing electromagnetic mod=
elling, and this is necessary sometimes (often). <br><br>From what I can te=
ll std::sqrt returns the root in either the first or fourth quadrant of the=
 complex plane, same as FORTRAN (I think). <br>
(Arbitrary, but useful for me)<br><br>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. <br><br>I guess I don&#39;t really understand your argument=
 fully. Is the behaviour of std::sqrt() for complexes not mandated by the C=
++ standard committee?=C2=A0 Or does this vary across compilers? If it is a=
t least supposed to be consistent, then all you are doing is passing along =
expected behaviour of C++ to Eigen users, right?<br>
<br>Thanks,<br>-Trevor =C2=A0 <br>
<br><br><div class=3D"gmail_quote">2010/1/7 Benoit Jacob <span dir=3D"ltr">=
&lt;<a href=3D"mailto:jacob.benoit.1@xxxxxxxxx";>jacob.benoit.1@xxxxxxxxx</a=
>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px=
 solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It is on purpose that we excluded sqrt for complex numbers:<br>
=C2=A0- there is no canonical choice between the 2 determinations of the sq=
uare root.<br>
=C2=A0- no important use case was known to us.<br>
<br>
Do you have a use case?<br>
<br>
Benoit<br>
<br>
2010/1/7 Trevor Irons &lt;<a href=3D"mailto:trevorirons@xxxxxxxxx";>trevorir=
ons@xxxxxxxxx</a>&gt;:<br>
<div><div></div><div class=3D"h5">&gt; Any problem adding the following pat=
ch, or something similiar, to<br>
&gt; MathFunctions.h to support std::complex&lt;&gt;.sqrt() ?<br>
&gt;<br>
&gt; 218d217<br>
&gt; &lt; inline std::complex&lt;float&gt; ei_sqrt(std::complex&lt;float&gt=
;x)=C2=A0 { return<br>
&gt; std::sqrt(x); }<br>
&gt; 256d254<br>
&gt; &lt; inline std::complex&lt;double&gt; ei_sqrt(std::complex&lt;double&=
gt;x)=C2=A0 { return<br>
&gt; std::sqrt(x); }<br>
&gt;<br>
&gt;<br>
&gt; -trevor<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br>

--0016367f956ccae08b047c99fe4b--



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