PaStiX Handbook  6.3.2
datatypes.h
Go to the documentation of this file.
1 /**
2  *
3  * @file datatypes.h
4  *
5  * @copyright 2013-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
6  * Univ. Bordeaux. All rights reserved.
7  *
8  * Definitions of the datatypes used in PaStiX
9  *
10  * @version 6.3.2
11  * @author Mathieu Faverge
12  * @author Xavier Lacoste
13  * @author Pierre Ramet
14  * @author Tony Delarue
15  * @date 2023-07-21
16  *
17  */
18 #ifndef _pastix_datatypes_h_
19 #define _pastix_datatypes_h_
20 
21 #include <stdint.h>
22 
23 BEGIN_C_DECLS
24 
25 /** ****************************************************************************
26  * Integers
27  **/
28 #if defined(PASTIX_INT64)
29 
30 typedef int64_t pastix_int_t;
31 typedef uint64_t pastix_uint_t;
32 #define PASTIX_MPI_INT MPI_INTEGER8
33 #define PASTIX_INT_MAX INT64_MAX
34 
35 #elif defined(PASTIX_INT32)
36 
37 typedef int32_t pastix_int_t;
38 typedef uint32_t pastix_uint_t;
39 #define PASTIX_MPI_INT MPI_INTEGER4
40 #define PASTIX_INT_MAX INT32_MAX
41 
42 #elif defined(PASTIX_LONG)
43 
44 typedef long pastix_int_t;
45 typedef unsigned long pastix_uint_t;
46 #define PASTIX_MPI_INT MPI_LONG
47 #define PASTIX_INT_MAX LONG_MAX
48 
49 #else
50 
51 typedef int pastix_int_t;
52 typedef unsigned int pastix_uint_t;
53 #define PASTIX_MPI_INT MPI_INT
54 #define PASTIX_INT_MAX INT_MAX
55 
56 #endif
57 
58 #ifndef NAN
59 #define NAN ( 0. / 0. )
60 #endif
61 
62 /** ****************************************************************************
63  * Double that are not converted through precision generator functions
64  **/
65 typedef double pastix_fixdbl_t;
66 
67 /** ****************************************************************************
68  * Complex numbers (Extracted from PaRSEC project)
69  **/
70 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
71 /* Windows and non-Intel compiler */
72 #include <complex>
73 typedef std::complex<float> pastix_complex32_t;
74 typedef std::complex<double> pastix_complex64_t;
75 #else
76 typedef float _Complex pastix_complex32_t;
77 typedef double _Complex pastix_complex64_t;
78 #endif
79 
80 #if !defined(__cplusplus) && defined(HAVE_COMPLEX_H)
81 #include <complex.h>
82 #else
83 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 
88 /* These declarations will not clash with what C++ provides because
89  * the names in C++ are name-mangled. */
90 
91 extern double cabs (pastix_complex64_t z);
92 extern double creal (pastix_complex64_t z);
93 extern double cimag (pastix_complex64_t z);
94 
95 extern float cabsf (pastix_complex32_t z);
96 extern float crealf (pastix_complex32_t z);
97 extern float cimagf (pastix_complex32_t z);
98 
99 extern pastix_complex64_t conj (pastix_complex64_t z);
100 extern pastix_complex64_t csqrt (pastix_complex64_t z);
101 
102 extern pastix_complex32_t conjf (pastix_complex32_t z);
103 extern pastix_complex32_t csqrtf(pastix_complex32_t z);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* HAVE_COMPLEX_H */
110 
111 #define PASTIX_MPI_COMPLEX64 MPI_C_DOUBLE_COMPLEX
112 #define PASTIX_MPI_COMPLEX32 MPI_C_FLOAT_COMPLEX
113 #define PASTIX_MPI_DOUBLE MPI_DOUBLE
114 #define PASTIX_MPI_FLOAT MPI_FLOAT
115 
116 static inline size_t
117 pastix_size_of(pastix_coeftype_t type)
118 {
119  switch(type) {
120  case PastixFloat: return sizeof(float);
121  case PastixDouble: return sizeof(double);
122  case PastixComplex32: return 2*sizeof(float);
123  case PastixComplex64: return 2*sizeof(double);
124  default:
125  fprintf(stderr, "pastix_size_of: invalid type parameter\n");
126  assert(0);
127  return sizeof(double);
128  }
129 }
130 
131 /******************************************************************************
132  * Pastix data structures
133  **/
134 
135 /* Sparse matrix */
136 struct spmatrix_s;
137 typedef struct spmatrix_s spmatrix_t;
138 
139 /* To make it compatible with version with spm inside pastix */
140 typedef spmatrix_t pastix_spm_t;
141 
142 /* Main structure of the pastix solver associated to a given problem */
143 struct pastix_data_s;
144 typedef struct pastix_data_s pastix_data_t;
145 
146 /* Graph structure (No values) */
147 typedef struct spmatrix_s pastix_graph_t;
148 
149 /* Ordering structure */
150 struct pastix_order_s;
151 typedef struct pastix_order_s pastix_order_t;
152 
153 /* Solver matrix structure to store L(U)*/
154 struct solver_matrix_s;
155 typedef struct solver_matrix_s SolverMatrix;
156 
157 /* Main structure to store a Right-Hand-Side in which the permutation has been applied */
158 struct pastix_rhs_s;
159 typedef struct pastix_rhs_s * pastix_rhs_t;
160 
161 END_C_DECLS
162 
163 #endif /* _pastix_datatypes_h_ */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
float _Complex pastix_complex32_t
Definition: datatypes.h:76
double pastix_fixdbl_t
Definition: datatypes.h:65
spm_coeftype_t pastix_coeftype_t
Arithmetic types.
Definition: api.h:294
Order structure.
Definition: order.h:47
Main PaStiX data structure.
Definition: pastixdata.h:67
Main PaStiX RHS structure.
Definition: pastixdata.h:150
Solver column block structure.
Definition: solver.h:200