petsc-3.10.5 2019-03-28
Report Typos and Errors

# PetscScalar

PETSc type that represents either a double precision real number, a double precision complex number, a single precision real number, a __float128 real or complex or a __fp16 real - if the code is configured with --with-scalar-type=real,complex --with-precision=single,double,__float128,__fp16

### Notes

For MPI calls that require datatypes, use MPIU_SCALAR as the datatype for PetscScalar and MPIU_SUM, MPIU_MAX etc for operations. They will automatically work correctly regardless of the size of PetscScalar.

### See Also

PetscReal, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT, PetscRealPart(), PetscImaginaryPart()

### Level

beginner

### Location

include/petscsys.h

### Examples

src/vec/vec/examples/tutorials/ex5.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/vec/examples/tutorials/ex10.c.html
src/vec/vec/examples/tutorials/ex15.c.html
src/vec/vec/examples/tutorials/ex4f90.F90.html
src/vec/is/sf/examples/tutorials/ex2.c.html
src/mat/examples/tutorials/ex8.c.html
src/dm/examples/tutorials/ex15.c.html
src/dm/examples/tutorials/ex11f90.F90.html
src/dm/field/examples/tutorials/ex1.c.html
src/ksp/ksp/examples/tutorials/ex3.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages