[petsc-dev] VecSqrt() for complex numbers?

Barry Smith bsmith at mcs.anl.gov
Fri Apr 9 15:40:06 CDT 2010


   Suggest rename VecSqrt() to be VecSqrtAbs() and then in the future  
if someone wants it they can add VecSqrt()?

    Barry

On Apr 9, 2010, at 3:37 PM, Jed Brown wrote:

> On Fri, Apr 9, 2010 at 13:34, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>>  Should VecSqrt() for complex numbers take the square root of the  
>> absolute
>> value (as it does for real numbers) or should be actually be the  
>> square
>> root?
>
> I think it is critical that
>
>  VecSet(x,-1);
>  VecSqrt(x);
>
> means the same thing when compiled with real and complex.  If you want
> VecSqrt to actually do a square root instead of sqrt(abs(x)), then the
> above should generate an error with scalar-type=real, otherwise this
> different functionality needs to be a different function.
>
> Jed




More information about the petsc-dev mailing list