> complex version is needed since matrix sometimes is real and sometimes is > complex. PetscScalar is a flexible datatype, it will be real if PETSc is configured without complex support and include complex if PETSc is configured with complex.
> I want to solve real matrix without allocating memory for imaginary > part((except eigen pairs). If you only want to use the real component of a PetscScalar you can use PetscRealPart() https://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscRealPart.html <https://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscRealPart.html> to extract it. Best regards, Jacob Faibussowitsch (Jacob Fai - booss - oh - vitch) Cell: (312) 694-3391 > On May 26, 2020, at 3:28 PM, Sam Guo <sam....@cd-adapco.com> wrote: > > complex version is needed since matrix sometimes is real and sometimes is > complex. I want to solve real matrix without allocating memory for imaginary > part((except eigen pairs). > > On Tuesday, May 26, 2020, Zhang, Hong <hzh...@mcs.anl.gov > <mailto:hzh...@mcs.anl.gov>> wrote: > You can build PETSc with complex version, and declare some variables as > 'PETSC_REAL'. > Hong > > From: petsc-users <petsc-users-boun...@mcs.anl.gov > <mailto:petsc-users-boun...@mcs.anl.gov>> on behalf of Sam Guo > <sam....@cd-adapco.com <mailto:sam....@cd-adapco.com>> > Sent: Tuesday, May 26, 2020 1:00 PM > To: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>> > Subject: [petsc-users] using real and complex together > > Dear PETSc dev team, > Can I use both real and complex versions together? > > Thanks, > Sam