[petsc-users] [petsc-maint] (no subject)

Smith, Barry F. bsmith at mcs.anl.gov
Tue Jan 7 09:21:50 CST 2020



> On Jan 7, 2020, at 8:59 AM, Mark Adams <mfadams at lbl.gov> wrote:
> 
>  I’m not sure what the compilers, and C++ are doing here 
> 
> On Tue, Jan 7, 2020 at 9:17 AM Кудров Илья <ilyakudrov at yandex.ru> wrote:
> However, after configuring
>  
> cout<<1. + 1.*PETSC_i<<endl;
>  
> outputs (1, 0) instead of (1, 1).

   Where after configure? PETSC_i is not defined until after PetscInitialize() is called. Send full example.

   Here is the code that defines it

  /*
     Initialized the global complex variable; this is because with
     shared libraries the constructors for global variables
     are not called; at least on IRIX.
  */
#if defined(PETSC_HAVE_COMPLEX)
  {
#if defined(PETSC_CLANGUAGE_CXX) && !defined(PETSC_USE_REAL___FLOAT128)
    PetscComplex ic(0.0,1.0);
    PETSC_i = ic;
#else
    PETSC_i = _Complex_I;
#endif
  }

Perhaps it is problematic in C++?  With single precision? Try PetscComplex ic(0.0,1.0); and see what ic is

   Barry

>  
> 07.01.2020, 16:01, "Mark Adams" <mfadams at lbl.gov>:
> yes, configure with
>  
> --with-precision=single 
> --with-scalar-type=complex
>  
>  
> On Tue, Jan 7, 2020 at 7:49 AM Кудров Илья <ilyakudrov at yandex.ru> wrote:
> Good day! Is it possible to use complex numbers in single precision in linear solvers? I'd like to decrease time and memory needed for calculation.
>  
> Best regards, Ilya Kudrov!



More information about the petsc-users mailing list