xref: /petsc/include/petscmath.h (revision debe9ee2755b2e6ee26f815bab511dcc308e711d)
1e489efc1SBarry Smith /*
2314da920SBarry Smith 
3314da920SBarry Smith       PETSc mathematics include file. Defines certain basic mathematical
4a5057860SBarry Smith     constants and functions for working with single, double, and quad precision
5a5057860SBarry Smith     floating point numbers as well as complex single and double.
6314da920SBarry Smith 
7d382aafbSBarry Smith     This file is included by petscsys.h and should not be used directly.
8e7029fe1SSatish Balay 
9e489efc1SBarry Smith */
10e489efc1SBarry Smith 
11488ecbafSBarry Smith #if !defined(__PETSCMATH_H)
12488ecbafSBarry Smith #define __PETSCMATH_H
130a5f7794SBarry Smith #include <math.h>
140a5f7794SBarry Smith 
15014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_2SCALAR;
16014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_2INT;
17c90a1750SBarry Smith 
18314da920SBarry Smith /*
19f4ccad53SBarry Smith 
20f4ccad53SBarry Smith      Defines operations that are different for complex and real numbers;
21a5057860SBarry Smith    note that one cannot mix the use of complex and real in the same
22f4ccad53SBarry Smith    PETSc program. All PETSc objects in one program are built around the object
2398725619SBarry Smith    PetscScalar which is either always a real or a complex.
24f4ccad53SBarry Smith 
25e489efc1SBarry Smith */
26b36a9721SBarry Smith 
2759cb5930SBarry Smith #define PetscExpPassiveScalar(a) PetscExpScalar()
28c1d390e3SJed Brown #if defined(PETSC_USE_REAL_SINGLE)
29c1d390e3SJed Brown #define MPIU_REAL   MPI_FLOAT
30c1d390e3SJed Brown typedef float PetscReal;
318f1a2a5eSBarry Smith #define PetscSqrtReal(a)    sqrt(a)
32c1d390e3SJed Brown #elif defined(PETSC_USE_REAL_DOUBLE)
33c1d390e3SJed Brown #define MPIU_REAL   MPI_DOUBLE
34c1d390e3SJed Brown typedef double PetscReal;
358f1a2a5eSBarry Smith #define PetscSqrtReal(a)    sqrt(a)
36c1d390e3SJed Brown #elif defined(PETSC_USE_REAL___FLOAT128)
37574fde7bSSatish Balay #if defined(__cplusplus)
38574fde7bSSatish Balay extern "C" {
39574fde7bSSatish Balay #endif
40574fde7bSSatish Balay #include <quadmath.h>
41574fde7bSSatish Balay #if defined(__cplusplus)
42574fde7bSSatish Balay }
43574fde7bSSatish Balay #endif
44c1d390e3SJed Brown #define MPIU_REAL MPIU___FLOAT128
45c1d390e3SJed Brown typedef __float128 PetscReal;
468f1a2a5eSBarry Smith #define PetscSqrtReal(a)    sqrtq(a)
47c1d390e3SJed Brown #endif /* PETSC_USE_REAL_* */
4859cb5930SBarry Smith 
491093a601SBarry Smith /*
501093a601SBarry Smith     Complex number definitions
511093a601SBarry Smith  */
52aa482453SBarry Smith #if defined(PETSC_USE_COMPLEX)
53b7940d39SSatish Balay #if defined(PETSC_CLANGUAGE_CXX)
541093a601SBarry Smith /* C++ support of complex number */
55*debe9ee2SPaul Mullowney #if defined(PETSC_HAVE_CUSP)
56*debe9ee2SPaul Mullowney #define complexlib cusp
579ae82921SPaul Mullowney #include <cusp/complex.h>
58*debe9ee2SPaul Mullowney #else
59*debe9ee2SPaul Mullowney #define complexlib std
60*debe9ee2SPaul Mullowney #include <complex>
619ae82921SPaul Mullowney #endif
62b7940d39SSatish Balay 
63*debe9ee2SPaul Mullowney #define PetscRealPart(a)      (a).real()
64*debe9ee2SPaul Mullowney #define PetscImaginaryPart(a) (a).imag()
65*debe9ee2SPaul Mullowney #define PetscAbsScalar(a)     complexlib::abs(a)
66*debe9ee2SPaul Mullowney #define PetscConj(a)          complexlib::conj(a)
67*debe9ee2SPaul Mullowney #define PetscSqrtScalar(a)    complexlib::sqrt(a)
68*debe9ee2SPaul Mullowney #define PetscPowScalar(a,b)   complexlib::pow(a,b)
69*debe9ee2SPaul Mullowney #define PetscExpScalar(a)     complexlib::exp(a)
70*debe9ee2SPaul Mullowney #define PetscLogScalar(a)     complexlib::log(a)
71*debe9ee2SPaul Mullowney #define PetscSinScalar(a)     complexlib::sin(a)
72*debe9ee2SPaul Mullowney #define PetscCosScalar(a)     complexlib::cos(a)
73*debe9ee2SPaul Mullowney 
74*debe9ee2SPaul Mullowney #if defined(PETSC_USE_REAL_SINGLE)
75*debe9ee2SPaul Mullowney typedef complexlib::complex<float> PetscScalar;
76*debe9ee2SPaul Mullowney #elif defined(PETSC_USE_REAL_DOUBLE)
77*debe9ee2SPaul Mullowney typedef complexlib::complex<double> PetscScalar;
78*debe9ee2SPaul Mullowney #endif  /* PETSC_USE_REAL_ */
79*debe9ee2SPaul Mullowney 
801b65fc54SMatthew G Knepley #else /* PETSC_CLANGUAGE_CXX */
81b7940d39SSatish Balay 
82ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
8385b47369SMatthew Knepley typedef float complex PetscScalar;
8485b47369SMatthew Knepley 
8585b47369SMatthew Knepley #define PetscRealPart(a)      crealf(a)
8685b47369SMatthew Knepley #define PetscImaginaryPart(a) cimagf(a)
8785b47369SMatthew Knepley #define PetscAbsScalar(a)     cabsf(a)
8885b47369SMatthew Knepley #define PetscConj(a)          conjf(a)
8985b47369SMatthew Knepley #define PetscSqrtScalar(a)    csqrtf(a)
9085b47369SMatthew Knepley #define PetscPowScalar(a,b)   cpowf(a,b)
9185b47369SMatthew Knepley #define PetscExpScalar(a)     cexpf(a)
9206c1185fSBarry Smith #define PetscLogScalar(a)     clogf(a)
9385b47369SMatthew Knepley #define PetscSinScalar(a)     csinf(a)
9485b47369SMatthew Knepley #define PetscCosScalar(a)     ccosf(a)
951093a601SBarry Smith 
96ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
971093a601SBarry Smith typedef double complex PetscScalar;
981093a601SBarry Smith 
991093a601SBarry Smith #define PetscRealPart(a)      creal(a)
1001093a601SBarry Smith #define PetscImaginaryPart(a) cimag(a)
1011093a601SBarry Smith #define PetscAbsScalar(a)     cabs(a)
1021093a601SBarry Smith #define PetscConj(a)          conj(a)
1031093a601SBarry Smith #define PetscSqrtScalar(a)    csqrt(a)
1041093a601SBarry Smith #define PetscPowScalar(a,b)   cpow(a,b)
1051093a601SBarry Smith #define PetscExpScalar(a)     cexp(a)
1061093a601SBarry Smith #define PetscLogScalar(a)     clog(a)
1071093a601SBarry Smith #define PetscSinScalar(a)     csin(a)
1081093a601SBarry Smith #define PetscCosScalar(a)     ccos(a)
1091093a601SBarry Smith 
110ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
1111b65fc54SMatthew G Knepley #endif /* PETSC_CLANGUAGE_CXX */
112e489efc1SBarry Smith 
11370da9c3bSJed Brown #if defined(PETSC_HAVE_MPI_C_DOUBLE_COMPLEX)
114500d8756SSatish Balay #define MPIU_C_DOUBLE_COMPLEX MPI_C_DOUBLE_COMPLEX
115500d8756SSatish Balay #define MPIU_C_COMPLEX MPI_C_COMPLEX
11670da9c3bSJed Brown #else
117014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_C_DOUBLE_COMPLEX;
118014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_C_COMPLEX;
1191b65fc54SMatthew G Knepley #endif /* PETSC_HAVE_MPI_C_DOUBLE_COMPLEX */
1202c876bd9SBarry Smith 
121ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
122500d8756SSatish Balay #define MPIU_SCALAR MPIU_C_COMPLEX
123ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
124500d8756SSatish Balay #define MPIU_SCALAR MPIU_C_DOUBLE_COMPLEX
125ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
12675567043SBarry Smith 
1271093a601SBarry Smith /*
1281093a601SBarry Smith     real number definitions
1291093a601SBarry Smith  */
1301b65fc54SMatthew G Knepley #else /* PETSC_USE_COMPLEX */
131ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
13287828ca2SBarry Smith #define MPIU_SCALAR           MPI_FLOAT
1331093a601SBarry Smith typedef float PetscScalar;
134ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
1351093a601SBarry Smith #define MPIU_SCALAR           MPI_DOUBLE
1361093a601SBarry Smith typedef double PetscScalar;
137ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL___FLOAT128)
138014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU___FLOAT128;
139c90a1750SBarry Smith #define MPIU_SCALAR MPIU___FLOAT128
1400d0cc1b5SBarry Smith typedef __float128 PetscScalar;
141ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
142329f5518SBarry Smith #define PetscRealPart(a)      (a)
143c1d390e3SJed Brown #define PetscImaginaryPart(a) ((PetscReal)0.)
144c1d390e3SJed Brown PETSC_STATIC_INLINE PetscReal PetscAbsScalar(PetscScalar a) {return a < 0.0 ? -a : a;}
145e489efc1SBarry Smith #define PetscConj(a)          (a)
146ce63c4c1SBarry Smith #if !defined(PETSC_USE_REAL___FLOAT128)
14718a7d68fSSatish Balay #define PetscSqrtScalar(a)    sqrt(a)
148184914b5SBarry Smith #define PetscPowScalar(a,b)   pow(a,b)
149184914b5SBarry Smith #define PetscExpScalar(a)     exp(a)
15006c1185fSBarry Smith #define PetscLogScalar(a)     log(a)
151184914b5SBarry Smith #define PetscSinScalar(a)     sin(a)
152184914b5SBarry Smith #define PetscCosScalar(a)     cos(a)
153ce63c4c1SBarry Smith #else /* PETSC_USE_REAL___FLOAT128 */
1540d0cc1b5SBarry Smith #define PetscSqrtScalar(a)    sqrtq(a)
1550d0cc1b5SBarry Smith #define PetscPowScalar(a,b)   powq(a,b)
1560d0cc1b5SBarry Smith #define PetscExpScalar(a)     expq(a)
1570d0cc1b5SBarry Smith #define PetscLogScalar(a)     logq(a)
1580d0cc1b5SBarry Smith #define PetscSinScalar(a)     sinq(a)
1590d0cc1b5SBarry Smith #define PetscCosScalar(a)     cosq(a)
160ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL___FLOAT128 */
161b0a32e0cSBarry Smith 
1621b65fc54SMatthew G Knepley #endif /* PETSC_USE_COMPLEX */
163e489efc1SBarry Smith 
164da9b6338SBarry Smith #define PetscSign(a) (((a) >= 0) ? ((a) == 0 ? 0 : 1) : -1)
16526aa1773SMatthew Knepley #define PetscAbs(a)  (((a) >= 0) ? (a) : -(a))
1663f1db9ecSBarry Smith 
167314da920SBarry Smith /* --------------------------------------------------------------------------*/
168314da920SBarry Smith 
169e489efc1SBarry Smith /*
170f22f69f0SBarry Smith    Certain objects may be created using either single or double precision.
171f22f69f0SBarry Smith    This is currently not used.
172e489efc1SBarry Smith */
173557d4da8SBarry Smith typedef enum { PETSC_SCALAR_DOUBLE,PETSC_SCALAR_SINGLE, PETSC_SCALAR_LONG_DOUBLE } PetscScalarPrecision;
174e489efc1SBarry Smith 
175e489efc1SBarry Smith /* PETSC_i is the imaginary number, i */
176014dd563SJed Brown PETSC_EXTERN PetscScalar   PETSC_i;
177e489efc1SBarry Smith 
178b6a5bde7SBarry Smith /*MC
179b6a5bde7SBarry Smith    PetscMin - Returns minimum of two numbers
180b6a5bde7SBarry Smith 
181eca87e8dSBarry Smith    Synopsis:
182eca87e8dSBarry Smith    type PetscMin(type v1,type v2)
183eca87e8dSBarry Smith 
184eca87e8dSBarry Smith    Not Collective
185eca87e8dSBarry Smith 
186b6a5bde7SBarry Smith    Input Parameter:
187b6a5bde7SBarry Smith +  v1 - first value to find minimum of
188b6a5bde7SBarry Smith -  v2 - second value to find minimum of
189b6a5bde7SBarry Smith 
190b6a5bde7SBarry Smith 
191b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
192b6a5bde7SBarry Smith 
193b6a5bde7SBarry Smith    Level: beginner
194b6a5bde7SBarry Smith 
195b6a5bde7SBarry Smith 
196d9a4bb16SJed Brown .seealso: PetscMin(), PetscClipInterval(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
197b6a5bde7SBarry Smith 
198b6a5bde7SBarry Smith M*/
199e489efc1SBarry Smith #define PetscMin(a,b)   (((a)<(b)) ?  (a) : (b))
200b6a5bde7SBarry Smith 
201b6a5bde7SBarry Smith /*MC
202b6a5bde7SBarry Smith    PetscMax - Returns maxium of two numbers
203b6a5bde7SBarry Smith 
204eca87e8dSBarry Smith    Synopsis:
205eca87e8dSBarry Smith    type max PetscMax(type v1,type v2)
206eca87e8dSBarry Smith 
207eca87e8dSBarry Smith    Not Collective
208eca87e8dSBarry Smith 
209b6a5bde7SBarry Smith    Input Parameter:
210b6a5bde7SBarry Smith +  v1 - first value to find maximum of
211b6a5bde7SBarry Smith -  v2 - second value to find maximum of
212b6a5bde7SBarry Smith 
213b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
214b6a5bde7SBarry Smith 
215b6a5bde7SBarry Smith    Level: beginner
216b6a5bde7SBarry Smith 
217d9a4bb16SJed Brown .seealso: PetscMin(), PetscClipInterval(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
218b6a5bde7SBarry Smith 
219b6a5bde7SBarry Smith M*/
220e489efc1SBarry Smith #define PetscMax(a,b)   (((a)<(b)) ?  (b) : (a))
221b6a5bde7SBarry Smith 
222b6a5bde7SBarry Smith /*MC
223d9a4bb16SJed Brown    PetscClipInterval - Returns a number clipped to be within an interval
224d9a4bb16SJed Brown 
225d9a4bb16SJed Brown    Synopsis:
226d9a4bb16SJed Brown    type clip PetscClipInterval(type x,type a,type b)
227d9a4bb16SJed Brown 
228d9a4bb16SJed Brown    Not Collective
229d9a4bb16SJed Brown 
230d9a4bb16SJed Brown    Input Parameter:
231d9a4bb16SJed Brown +  x - value to use if within interval (a,b)
232d9a4bb16SJed Brown .  a - lower end of interval
233d9a4bb16SJed Brown -  b - upper end of interval
234d9a4bb16SJed Brown 
235d9a4bb16SJed Brown    Notes: type can be integer or floating point value
236d9a4bb16SJed Brown 
237d9a4bb16SJed Brown    Level: beginner
238d9a4bb16SJed Brown 
239d9a4bb16SJed Brown .seealso: PetscMin(), PetscMax(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
240d9a4bb16SJed Brown 
241d9a4bb16SJed Brown M*/
242d9a4bb16SJed Brown #define PetscClipInterval(x,a,b)   (PetscMax((a),PetscMin((x),(b))))
243d9a4bb16SJed Brown 
244d9a4bb16SJed Brown /*MC
245b6a5bde7SBarry Smith    PetscAbsInt - Returns the absolute value of an integer
246b6a5bde7SBarry Smith 
247b6a5bde7SBarry Smith    Synopsis:
248b6a5bde7SBarry Smith    int abs PetscAbsInt(int v1)
249b6a5bde7SBarry Smith 
250eca87e8dSBarry Smith    Not Collective
251eca87e8dSBarry Smith 
252eca87e8dSBarry Smith    Input Parameter:
253eca87e8dSBarry Smith .   v1 - the integer
254b6a5bde7SBarry Smith 
255b6a5bde7SBarry Smith    Level: beginner
256b6a5bde7SBarry Smith 
257b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsReal(), PetscSqr()
258b6a5bde7SBarry Smith 
259b6a5bde7SBarry Smith M*/
260e489efc1SBarry Smith #define PetscAbsInt(a)  (((a)<0)   ? -(a) : (a))
261b6a5bde7SBarry Smith 
262b6a5bde7SBarry Smith /*MC
263b6a5bde7SBarry Smith    PetscAbsReal - Returns the absolute value of an real number
264b6a5bde7SBarry Smith 
265eca87e8dSBarry Smith    Synopsis:
266eca87e8dSBarry Smith    Real abs PetscAbsReal(PetscReal v1)
267eca87e8dSBarry Smith 
268eca87e8dSBarry Smith    Not Collective
269eca87e8dSBarry Smith 
270b6a5bde7SBarry Smith    Input Parameter:
271b6a5bde7SBarry Smith .   v1 - the double
272b6a5bde7SBarry Smith 
273b6a5bde7SBarry Smith 
274b6a5bde7SBarry Smith    Level: beginner
275b6a5bde7SBarry Smith 
276b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsInt(), PetscSqr()
277b6a5bde7SBarry Smith 
278b6a5bde7SBarry Smith M*/
279f6275e2eSBarry Smith #define PetscAbsReal(a) (((a)<0)   ? -(a) : (a))
280b6a5bde7SBarry Smith 
281b6a5bde7SBarry Smith /*MC
282b6a5bde7SBarry Smith    PetscSqr - Returns the square of a number
283b6a5bde7SBarry Smith 
284b6a5bde7SBarry Smith    Synopsis:
285b6a5bde7SBarry Smith    type sqr PetscSqr(type v1)
286b6a5bde7SBarry Smith 
287eca87e8dSBarry Smith    Not Collective
288eca87e8dSBarry Smith 
289eca87e8dSBarry Smith    Input Parameter:
290eca87e8dSBarry Smith .   v1 - the value
291eca87e8dSBarry Smith 
292b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
293b6a5bde7SBarry Smith 
294b6a5bde7SBarry Smith    Level: beginner
295b6a5bde7SBarry Smith 
296b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsInt(), PetscAbsReal()
297b6a5bde7SBarry Smith 
298b6a5bde7SBarry Smith M*/
2994ebda54eSMatthew Knepley #define PetscSqr(a)     ((a)*(a))
300e489efc1SBarry Smith 
301314da920SBarry Smith /* ----------------------------------------------------------------------------*/
302314da920SBarry Smith /*
303d34fcf5fSBarry Smith      Basic constants
304314da920SBarry Smith */
305ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL___FLOAT128)
306d34fcf5fSBarry Smith #define PETSC_PI                 M_PIq
307d34fcf5fSBarry Smith #elif defined(M_PI)
308d34fcf5fSBarry Smith #define PETSC_PI                 M_PI
309d34fcf5fSBarry Smith #else
310faa6e9b0SMatthew G Knepley #define PETSC_PI                 3.14159265358979323846264338327950288419716939937510582
311d34fcf5fSBarry Smith #endif
312d34fcf5fSBarry Smith 
313ab824b78SBarry Smith #if !defined(PETSC_USE_64BIT_INDICES)
31471fd2e92SBarry Smith #define PETSC_MAX_INT            2147483647
315ab824b78SBarry Smith #define PETSC_MIN_INT            (-PETSC_MAX_INT - 1)
316ab824b78SBarry Smith #else
317ab824b78SBarry Smith #define PETSC_MAX_INT            9223372036854775807L
318ab824b78SBarry Smith #define PETSC_MIN_INT            (-PETSC_MAX_INT - 1)
319ab824b78SBarry Smith #endif
320e489efc1SBarry Smith 
321ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
322ab824b78SBarry Smith #  define PETSC_MAX_REAL                3.40282346638528860e+38F
323ea345e14SBarry Smith #  define PETSC_MIN_REAL                -PETSC_MAX_REAL
32482a7e548SBarry Smith #  define PETSC_MACHINE_EPSILON         1.19209290e-07F
32582a7e548SBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    3.45266983e-04F
326cf6e855fSSatish Balay #  define PETSC_SMALL                   1.e-5
327ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
328ab824b78SBarry Smith #  define PETSC_MAX_REAL                1.7976931348623157e+308
329ea345e14SBarry Smith #  define PETSC_MIN_REAL                -PETSC_MAX_REAL
33082a7e548SBarry Smith #  define PETSC_MACHINE_EPSILON         2.2204460492503131e-16
33182a7e548SBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    1.490116119384766e-08
332cf6e855fSSatish Balay #  define PETSC_SMALL                   1.e-10
333ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL___FLOAT128)
334ea345e14SBarry Smith #  define PETSC_MAX_REAL                FLT128_MAX
335ce63c4c1SBarry Smith #  define PETSC_MIN_REAL                -FLT128_MAX
336d34fcf5fSBarry Smith #  define PETSC_MACHINE_EPSILON         FLT128_EPSILON
337d34fcf5fSBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    1.38777878078e-17
338d34fcf5fSBarry Smith #  define PETSC_SMALL                   1.e-20
33982adfdadSBarry Smith #endif
34082adfdadSBarry Smith 
3419cf09972SJed Brown #if defined PETSC_HAVE_ADIC
3429cf09972SJed Brown /* Use MPI_Allreduce when ADIC is not available. */
343014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalMax(MPI_Comm, const PetscReal*,PetscReal*);
344014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalMin(MPI_Comm, const PetscReal*,PetscReal*);
345014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalSum(MPI_Comm, const PetscScalar*,PetscScalar*);
3469cf09972SJed Brown #endif
3473e523bebSBarry Smith 
348014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscIsInfOrNanScalar(PetscScalar);
349014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscIsInfOrNanReal(PetscReal);
3509a25a3ccSBarry Smith 
351314da920SBarry Smith /* ----------------------------------------------------------------------------*/
35287828ca2SBarry Smith #define PassiveReal   PetscReal
353ea709b57SSatish Balay #define PassiveScalar PetscScalar
354d3ecb3a7SBarry Smith 
35598725619SBarry Smith /*
35698725619SBarry Smith     These macros are currently hardwired to match the regular data types, so there is no support for a different
35798725619SBarry Smith     MatScalar from PetscScalar. We left the MatScalar in the source just in case we use it again.
35898725619SBarry Smith  */
35998725619SBarry Smith #define MPIU_MATSCALAR MPIU_SCALAR
36098725619SBarry Smith typedef PetscScalar MatScalar;
36198725619SBarry Smith typedef PetscReal MatReal;
36298725619SBarry Smith 
363e9fa29b7SSatish Balay 
364e489efc1SBarry Smith #endif
365