xref: /petsc/include/petscmath.h (revision 519e2a1f109d566d880bda2412f67ca238b99c72)
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 */
55debe9ee2SPaul Mullowney #if defined(PETSC_HAVE_CUSP)
56debe9ee2SPaul Mullowney #define complexlib cusp
579ae82921SPaul Mullowney #include <cusp/complex.h>
58debe9ee2SPaul Mullowney #else
59debe9ee2SPaul Mullowney #define complexlib std
60debe9ee2SPaul Mullowney #include <complex>
619ae82921SPaul Mullowney #endif
62b7940d39SSatish Balay 
63debe9ee2SPaul Mullowney #define PetscRealPart(a)      (a).real()
64debe9ee2SPaul Mullowney #define PetscImaginaryPart(a) (a).imag()
65debe9ee2SPaul Mullowney #define PetscAbsScalar(a)     complexlib::abs(a)
66debe9ee2SPaul Mullowney #define PetscConj(a)          complexlib::conj(a)
67debe9ee2SPaul Mullowney #define PetscSqrtScalar(a)    complexlib::sqrt(a)
68debe9ee2SPaul Mullowney #define PetscPowScalar(a,b)   complexlib::pow(a,b)
69debe9ee2SPaul Mullowney #define PetscExpScalar(a)     complexlib::exp(a)
70debe9ee2SPaul Mullowney #define PetscLogScalar(a)     complexlib::log(a)
71debe9ee2SPaul Mullowney #define PetscSinScalar(a)     complexlib::sin(a)
72debe9ee2SPaul Mullowney #define PetscCosScalar(a)     complexlib::cos(a)
73debe9ee2SPaul Mullowney 
74debe9ee2SPaul Mullowney #if defined(PETSC_USE_REAL_SINGLE)
75debe9ee2SPaul Mullowney typedef complexlib::complex<float> PetscScalar;
76debe9ee2SPaul Mullowney #elif defined(PETSC_USE_REAL_DOUBLE)
77debe9ee2SPaul Mullowney typedef complexlib::complex<double> PetscScalar;
78debe9ee2SPaul Mullowney #endif  /* PETSC_USE_REAL_ */
79debe9ee2SPaul Mullowney 
801b65fc54SMatthew G Knepley #else /* PETSC_CLANGUAGE_CXX */
81b7940d39SSatish Balay 
82*519e2a1fSPaul Mullowney /*  C support of complex numbers: Requires C99 compliant compiler*/
83*519e2a1fSPaul Mullowney #include <complex.h>
84*519e2a1fSPaul Mullowney 
85ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
8685b47369SMatthew Knepley typedef float complex PetscScalar;
8785b47369SMatthew Knepley 
8885b47369SMatthew Knepley #define PetscRealPart(a)      crealf(a)
8985b47369SMatthew Knepley #define PetscImaginaryPart(a) cimagf(a)
9085b47369SMatthew Knepley #define PetscAbsScalar(a)     cabsf(a)
9185b47369SMatthew Knepley #define PetscConj(a)          conjf(a)
9285b47369SMatthew Knepley #define PetscSqrtScalar(a)    csqrtf(a)
9385b47369SMatthew Knepley #define PetscPowScalar(a,b)   cpowf(a,b)
9485b47369SMatthew Knepley #define PetscExpScalar(a)     cexpf(a)
9506c1185fSBarry Smith #define PetscLogScalar(a)     clogf(a)
9685b47369SMatthew Knepley #define PetscSinScalar(a)     csinf(a)
9785b47369SMatthew Knepley #define PetscCosScalar(a)     ccosf(a)
981093a601SBarry Smith 
99ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
1001093a601SBarry Smith typedef double complex PetscScalar;
1011093a601SBarry Smith 
1021093a601SBarry Smith #define PetscRealPart(a)      creal(a)
1031093a601SBarry Smith #define PetscImaginaryPart(a) cimag(a)
1041093a601SBarry Smith #define PetscAbsScalar(a)     cabs(a)
1051093a601SBarry Smith #define PetscConj(a)          conj(a)
1061093a601SBarry Smith #define PetscSqrtScalar(a)    csqrt(a)
1071093a601SBarry Smith #define PetscPowScalar(a,b)   cpow(a,b)
1081093a601SBarry Smith #define PetscExpScalar(a)     cexp(a)
1091093a601SBarry Smith #define PetscLogScalar(a)     clog(a)
1101093a601SBarry Smith #define PetscSinScalar(a)     csin(a)
1111093a601SBarry Smith #define PetscCosScalar(a)     ccos(a)
1121093a601SBarry Smith 
113ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
1141b65fc54SMatthew G Knepley #endif /* PETSC_CLANGUAGE_CXX */
115e489efc1SBarry Smith 
11670da9c3bSJed Brown #if defined(PETSC_HAVE_MPI_C_DOUBLE_COMPLEX)
117500d8756SSatish Balay #define MPIU_C_DOUBLE_COMPLEX MPI_C_DOUBLE_COMPLEX
118500d8756SSatish Balay #define MPIU_C_COMPLEX MPI_C_COMPLEX
11970da9c3bSJed Brown #else
120014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_C_DOUBLE_COMPLEX;
121014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU_C_COMPLEX;
1221b65fc54SMatthew G Knepley #endif /* PETSC_HAVE_MPI_C_DOUBLE_COMPLEX */
1232c876bd9SBarry Smith 
124ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
125500d8756SSatish Balay #define MPIU_SCALAR MPIU_C_COMPLEX
126ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
127500d8756SSatish Balay #define MPIU_SCALAR MPIU_C_DOUBLE_COMPLEX
128ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
12975567043SBarry Smith 
1301093a601SBarry Smith /*
1311093a601SBarry Smith     real number definitions
1321093a601SBarry Smith  */
1331b65fc54SMatthew G Knepley #else /* PETSC_USE_COMPLEX */
134ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
13587828ca2SBarry Smith #define MPIU_SCALAR           MPI_FLOAT
1361093a601SBarry Smith typedef float PetscScalar;
137ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
1381093a601SBarry Smith #define MPIU_SCALAR           MPI_DOUBLE
1391093a601SBarry Smith typedef double PetscScalar;
140ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL___FLOAT128)
141014dd563SJed Brown PETSC_EXTERN MPI_Datatype MPIU___FLOAT128;
142c90a1750SBarry Smith #define MPIU_SCALAR MPIU___FLOAT128
1430d0cc1b5SBarry Smith typedef __float128 PetscScalar;
144ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL_* */
145329f5518SBarry Smith #define PetscRealPart(a)      (a)
146c1d390e3SJed Brown #define PetscImaginaryPart(a) ((PetscReal)0.)
147c1d390e3SJed Brown PETSC_STATIC_INLINE PetscReal PetscAbsScalar(PetscScalar a) {return a < 0.0 ? -a : a;}
148e489efc1SBarry Smith #define PetscConj(a)          (a)
149ce63c4c1SBarry Smith #if !defined(PETSC_USE_REAL___FLOAT128)
15018a7d68fSSatish Balay #define PetscSqrtScalar(a)    sqrt(a)
151184914b5SBarry Smith #define PetscPowScalar(a,b)   pow(a,b)
152184914b5SBarry Smith #define PetscExpScalar(a)     exp(a)
15306c1185fSBarry Smith #define PetscLogScalar(a)     log(a)
154184914b5SBarry Smith #define PetscSinScalar(a)     sin(a)
155184914b5SBarry Smith #define PetscCosScalar(a)     cos(a)
156ce63c4c1SBarry Smith #else /* PETSC_USE_REAL___FLOAT128 */
1570d0cc1b5SBarry Smith #define PetscSqrtScalar(a)    sqrtq(a)
1580d0cc1b5SBarry Smith #define PetscPowScalar(a,b)   powq(a,b)
1590d0cc1b5SBarry Smith #define PetscExpScalar(a)     expq(a)
1600d0cc1b5SBarry Smith #define PetscLogScalar(a)     logq(a)
1610d0cc1b5SBarry Smith #define PetscSinScalar(a)     sinq(a)
1620d0cc1b5SBarry Smith #define PetscCosScalar(a)     cosq(a)
163ce63c4c1SBarry Smith #endif /* PETSC_USE_REAL___FLOAT128 */
164b0a32e0cSBarry Smith 
1651b65fc54SMatthew G Knepley #endif /* PETSC_USE_COMPLEX */
166e489efc1SBarry Smith 
167da9b6338SBarry Smith #define PetscSign(a) (((a) >= 0) ? ((a) == 0 ? 0 : 1) : -1)
16826aa1773SMatthew Knepley #define PetscAbs(a)  (((a) >= 0) ? (a) : -(a))
1693f1db9ecSBarry Smith 
170314da920SBarry Smith /* --------------------------------------------------------------------------*/
171314da920SBarry Smith 
172e489efc1SBarry Smith /*
173f22f69f0SBarry Smith    Certain objects may be created using either single or double precision.
174f22f69f0SBarry Smith    This is currently not used.
175e489efc1SBarry Smith */
176557d4da8SBarry Smith typedef enum { PETSC_SCALAR_DOUBLE,PETSC_SCALAR_SINGLE, PETSC_SCALAR_LONG_DOUBLE } PetscScalarPrecision;
177e489efc1SBarry Smith 
178e489efc1SBarry Smith /* PETSC_i is the imaginary number, i */
179014dd563SJed Brown PETSC_EXTERN PetscScalar   PETSC_i;
180e489efc1SBarry Smith 
181b6a5bde7SBarry Smith /*MC
182b6a5bde7SBarry Smith    PetscMin - Returns minimum of two numbers
183b6a5bde7SBarry Smith 
184eca87e8dSBarry Smith    Synopsis:
185eca87e8dSBarry Smith    type PetscMin(type v1,type v2)
186eca87e8dSBarry Smith 
187eca87e8dSBarry Smith    Not Collective
188eca87e8dSBarry Smith 
189b6a5bde7SBarry Smith    Input Parameter:
190b6a5bde7SBarry Smith +  v1 - first value to find minimum of
191b6a5bde7SBarry Smith -  v2 - second value to find minimum of
192b6a5bde7SBarry Smith 
193b6a5bde7SBarry Smith 
194b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
195b6a5bde7SBarry Smith 
196b6a5bde7SBarry Smith    Level: beginner
197b6a5bde7SBarry Smith 
198b6a5bde7SBarry Smith 
199d9a4bb16SJed Brown .seealso: PetscMin(), PetscClipInterval(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
200b6a5bde7SBarry Smith 
201b6a5bde7SBarry Smith M*/
202e489efc1SBarry Smith #define PetscMin(a,b)   (((a)<(b)) ?  (a) : (b))
203b6a5bde7SBarry Smith 
204b6a5bde7SBarry Smith /*MC
205b6a5bde7SBarry Smith    PetscMax - Returns maxium of two numbers
206b6a5bde7SBarry Smith 
207eca87e8dSBarry Smith    Synopsis:
208eca87e8dSBarry Smith    type max PetscMax(type v1,type v2)
209eca87e8dSBarry Smith 
210eca87e8dSBarry Smith    Not Collective
211eca87e8dSBarry Smith 
212b6a5bde7SBarry Smith    Input Parameter:
213b6a5bde7SBarry Smith +  v1 - first value to find maximum of
214b6a5bde7SBarry Smith -  v2 - second value to find maximum of
215b6a5bde7SBarry Smith 
216b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
217b6a5bde7SBarry Smith 
218b6a5bde7SBarry Smith    Level: beginner
219b6a5bde7SBarry Smith 
220d9a4bb16SJed Brown .seealso: PetscMin(), PetscClipInterval(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
221b6a5bde7SBarry Smith 
222b6a5bde7SBarry Smith M*/
223e489efc1SBarry Smith #define PetscMax(a,b)   (((a)<(b)) ?  (b) : (a))
224b6a5bde7SBarry Smith 
225b6a5bde7SBarry Smith /*MC
226d9a4bb16SJed Brown    PetscClipInterval - Returns a number clipped to be within an interval
227d9a4bb16SJed Brown 
228d9a4bb16SJed Brown    Synopsis:
229d9a4bb16SJed Brown    type clip PetscClipInterval(type x,type a,type b)
230d9a4bb16SJed Brown 
231d9a4bb16SJed Brown    Not Collective
232d9a4bb16SJed Brown 
233d9a4bb16SJed Brown    Input Parameter:
234d9a4bb16SJed Brown +  x - value to use if within interval (a,b)
235d9a4bb16SJed Brown .  a - lower end of interval
236d9a4bb16SJed Brown -  b - upper end of interval
237d9a4bb16SJed Brown 
238d9a4bb16SJed Brown    Notes: type can be integer or floating point value
239d9a4bb16SJed Brown 
240d9a4bb16SJed Brown    Level: beginner
241d9a4bb16SJed Brown 
242d9a4bb16SJed Brown .seealso: PetscMin(), PetscMax(), PetscAbsInt(), PetscAbsReal(), PetscSqr()
243d9a4bb16SJed Brown 
244d9a4bb16SJed Brown M*/
245d9a4bb16SJed Brown #define PetscClipInterval(x,a,b)   (PetscMax((a),PetscMin((x),(b))))
246d9a4bb16SJed Brown 
247d9a4bb16SJed Brown /*MC
248b6a5bde7SBarry Smith    PetscAbsInt - Returns the absolute value of an integer
249b6a5bde7SBarry Smith 
250b6a5bde7SBarry Smith    Synopsis:
251b6a5bde7SBarry Smith    int abs PetscAbsInt(int v1)
252b6a5bde7SBarry Smith 
253eca87e8dSBarry Smith    Not Collective
254eca87e8dSBarry Smith 
255eca87e8dSBarry Smith    Input Parameter:
256eca87e8dSBarry Smith .   v1 - the integer
257b6a5bde7SBarry Smith 
258b6a5bde7SBarry Smith    Level: beginner
259b6a5bde7SBarry Smith 
260b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsReal(), PetscSqr()
261b6a5bde7SBarry Smith 
262b6a5bde7SBarry Smith M*/
263e489efc1SBarry Smith #define PetscAbsInt(a)  (((a)<0)   ? -(a) : (a))
264b6a5bde7SBarry Smith 
265b6a5bde7SBarry Smith /*MC
266b6a5bde7SBarry Smith    PetscAbsReal - Returns the absolute value of an real number
267b6a5bde7SBarry Smith 
268eca87e8dSBarry Smith    Synopsis:
269eca87e8dSBarry Smith    Real abs PetscAbsReal(PetscReal v1)
270eca87e8dSBarry Smith 
271eca87e8dSBarry Smith    Not Collective
272eca87e8dSBarry Smith 
273b6a5bde7SBarry Smith    Input Parameter:
274b6a5bde7SBarry Smith .   v1 - the double
275b6a5bde7SBarry Smith 
276b6a5bde7SBarry Smith 
277b6a5bde7SBarry Smith    Level: beginner
278b6a5bde7SBarry Smith 
279b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsInt(), PetscSqr()
280b6a5bde7SBarry Smith 
281b6a5bde7SBarry Smith M*/
282f6275e2eSBarry Smith #define PetscAbsReal(a) (((a)<0)   ? -(a) : (a))
283b6a5bde7SBarry Smith 
284b6a5bde7SBarry Smith /*MC
285b6a5bde7SBarry Smith    PetscSqr - Returns the square of a number
286b6a5bde7SBarry Smith 
287b6a5bde7SBarry Smith    Synopsis:
288b6a5bde7SBarry Smith    type sqr PetscSqr(type v1)
289b6a5bde7SBarry Smith 
290eca87e8dSBarry Smith    Not Collective
291eca87e8dSBarry Smith 
292eca87e8dSBarry Smith    Input Parameter:
293eca87e8dSBarry Smith .   v1 - the value
294eca87e8dSBarry Smith 
295b6a5bde7SBarry Smith    Notes: type can be integer or floating point value
296b6a5bde7SBarry Smith 
297b6a5bde7SBarry Smith    Level: beginner
298b6a5bde7SBarry Smith 
299b6a5bde7SBarry Smith .seealso: PetscMax(), PetscMin(), PetscAbsInt(), PetscAbsReal()
300b6a5bde7SBarry Smith 
301b6a5bde7SBarry Smith M*/
3024ebda54eSMatthew Knepley #define PetscSqr(a)     ((a)*(a))
303e489efc1SBarry Smith 
304314da920SBarry Smith /* ----------------------------------------------------------------------------*/
305314da920SBarry Smith /*
306d34fcf5fSBarry Smith      Basic constants
307314da920SBarry Smith */
308ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL___FLOAT128)
309d34fcf5fSBarry Smith #define PETSC_PI                 M_PIq
310d34fcf5fSBarry Smith #elif defined(M_PI)
311d34fcf5fSBarry Smith #define PETSC_PI                 M_PI
312d34fcf5fSBarry Smith #else
313faa6e9b0SMatthew G Knepley #define PETSC_PI                 3.14159265358979323846264338327950288419716939937510582
314d34fcf5fSBarry Smith #endif
315d34fcf5fSBarry Smith 
316ab824b78SBarry Smith #if !defined(PETSC_USE_64BIT_INDICES)
31771fd2e92SBarry Smith #define PETSC_MAX_INT            2147483647
318ab824b78SBarry Smith #define PETSC_MIN_INT            (-PETSC_MAX_INT - 1)
319ab824b78SBarry Smith #else
320ab824b78SBarry Smith #define PETSC_MAX_INT            9223372036854775807L
321ab824b78SBarry Smith #define PETSC_MIN_INT            (-PETSC_MAX_INT - 1)
322ab824b78SBarry Smith #endif
323e489efc1SBarry Smith 
324ce63c4c1SBarry Smith #if defined(PETSC_USE_REAL_SINGLE)
325ab824b78SBarry Smith #  define PETSC_MAX_REAL                3.40282346638528860e+38F
326ea345e14SBarry Smith #  define PETSC_MIN_REAL                -PETSC_MAX_REAL
32782a7e548SBarry Smith #  define PETSC_MACHINE_EPSILON         1.19209290e-07F
32882a7e548SBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    3.45266983e-04F
329cf6e855fSSatish Balay #  define PETSC_SMALL                   1.e-5
330ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL_DOUBLE)
331ab824b78SBarry Smith #  define PETSC_MAX_REAL                1.7976931348623157e+308
332ea345e14SBarry Smith #  define PETSC_MIN_REAL                -PETSC_MAX_REAL
33382a7e548SBarry Smith #  define PETSC_MACHINE_EPSILON         2.2204460492503131e-16
33482a7e548SBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    1.490116119384766e-08
335cf6e855fSSatish Balay #  define PETSC_SMALL                   1.e-10
336ce63c4c1SBarry Smith #elif defined(PETSC_USE_REAL___FLOAT128)
337ea345e14SBarry Smith #  define PETSC_MAX_REAL                FLT128_MAX
338ce63c4c1SBarry Smith #  define PETSC_MIN_REAL                -FLT128_MAX
339d34fcf5fSBarry Smith #  define PETSC_MACHINE_EPSILON         FLT128_EPSILON
340d34fcf5fSBarry Smith #  define PETSC_SQRT_MACHINE_EPSILON    1.38777878078e-17
341d34fcf5fSBarry Smith #  define PETSC_SMALL                   1.e-20
34282adfdadSBarry Smith #endif
34382adfdadSBarry Smith 
3449cf09972SJed Brown #if defined PETSC_HAVE_ADIC
3459cf09972SJed Brown /* Use MPI_Allreduce when ADIC is not available. */
346014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalMax(MPI_Comm, const PetscReal*,PetscReal*);
347014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalMin(MPI_Comm, const PetscReal*,PetscReal*);
348014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscGlobalSum(MPI_Comm, const PetscScalar*,PetscScalar*);
3499cf09972SJed Brown #endif
3503e523bebSBarry Smith 
351014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscIsInfOrNanScalar(PetscScalar);
352014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscIsInfOrNanReal(PetscReal);
3539a25a3ccSBarry Smith 
354314da920SBarry Smith /* ----------------------------------------------------------------------------*/
35587828ca2SBarry Smith #define PassiveReal   PetscReal
356ea709b57SSatish Balay #define PassiveScalar PetscScalar
357d3ecb3a7SBarry Smith 
35898725619SBarry Smith /*
35998725619SBarry Smith     These macros are currently hardwired to match the regular data types, so there is no support for a different
36098725619SBarry Smith     MatScalar from PetscScalar. We left the MatScalar in the source just in case we use it again.
36198725619SBarry Smith  */
36298725619SBarry Smith #define MPIU_MATSCALAR MPIU_SCALAR
36398725619SBarry Smith typedef PetscScalar MatScalar;
36498725619SBarry Smith typedef PetscReal MatReal;
36598725619SBarry Smith 
366e9fa29b7SSatish Balay 
367e489efc1SBarry Smith #endif
368