File: mt.h

package info (click to toggle)
mpsolve 3.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,100 kB
  • sloc: ansic: 25,748; sh: 4,925; cpp: 3,155; makefile: 914; python: 407; yacc: 158; lex: 85; xml: 41
file content (520 lines) | stat: -rw-r--r-- 18,934 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
/***********************************************************
**      More Types library for extended C arithmetic      **
**                      Version 1.1                       **
**                                                        **
**             Written by Giuseppe Fiorentino             **
**                 (fiorent@dm.unipi.it)                  **
**                                                        **
** (C) 1997, Dipartimento di Matematica, FRISCO LTR 21024 **
***********************************************************/

/**
 * @file
 * @brief Library with extended types in C.
 *
 * It contains complex types based on double and
 * DPE types (Double Plus Exponent) in real and
 * complex versions.
 */

#ifndef __MT_H__
#define __MT_H__

/*
 * This equality is set at compile time in a way that if the system doesn't have
 * complex.h support we can supply with our implementation. 
 */
#if 1 == 1
  #ifndef MPS_USE_BUILTIN_COMPLEX
    #define MPS_USE_BUILTIN_COMPLEX
  #endif
#endif

#include <stdio.h>

#ifdef __cplusplus
extern "C"
{
#endif

/***********************************************************
**              cplx_t type                               **
***********************************************************/

#ifdef MPS_USE_BUILTIN_COMPLEX

/* ----   definition  ---- */
  typedef struct
  {
    double r, i;                /* re, im */
  } __cplx_struct;

  typedef __cplx_struct cplx_t[1];
  typedef const __cplx_struct *cplx_cp;

/* macros for fields access */

#define cplx_Val(X)       (*(X))
#define cplx_Re(X)        ((X)->r)
#define cplx_Im(X)        ((X)->i)
#define cplx_Addr(X)      ((__cplx_struct *) (X))
#define cplx_Move(X1, X2) (*(X1) = *(X2))

/* base constants */
  extern const cplx_t cplx_zero;        /* complex zero  (0, 0)    */
  extern const cplx_t cplx_one; /* complex one   (1, 0)    */
  extern const cplx_t cplx_i;   /* imag. unit    (0, 1)    */

/* built constants */
  void cplx_d (cplx_t temp_cplx, double r, double i);

/* initializers */
#define cplx_init(X) cplx_clear(X)
  void cplx_clear (cplx_t x);
  void cplx_set (cplx_t rx, const cplx_t x);
  void cplx_set_d (cplx_t x, double dr, double di);
  int cplx_set_str (cplx_t x, const char *s);

  /* check floating point exceptions */
  int cplx_check_fpe (cplx_t x);

/* conversion */
  void cplx_get_d (double *dr, double *di, const cplx_t x);
  char *cplx_get_str (char *s, const cplx_t x);

/* unary functions */
  void cplx_neg (cplx_t rx, const cplx_t x);
  void cplx_con (cplx_t rx, const cplx_t x);
  double cplx_smod (const cplx_t x);
  double cplx_mod (const cplx_t x);
  void cplx_inv (cplx_t rx, const cplx_t x);
  void cplx_sqr (cplx_t rx, const cplx_t x);
  void cplx_rot (cplx_t rx, const cplx_t x);
  void cplx_flip (cplx_t rx, const cplx_t x);

/* binary functions */
  void cplx_add (cplx_t rx, const cplx_t x1, const cplx_t x2);
  void cplx_sub (cplx_t rx, const cplx_t x1, const cplx_t x2);
  void cplx_mul (cplx_t rx, const cplx_t x1, const cplx_t x2);
  void cplx_div (cplx_t rx, const cplx_t x1, const cplx_t x2);
  void cplx_mul_d (cplx_t rx, const cplx_t x, double d);
  void cplx_div_d (cplx_t rx, const cplx_t x, double d);
  void cplx_pow_si (cplx_t rx, const cplx_t x, signed long int i);

/* misc */
  void cplx_swap (cplx_t x1, cplx_t x2);

/* op= style operators */
  void cplx_neg_eq (cplx_t x);
  void cplx_con_eq (cplx_t x);
  void cplx_inv_eq (cplx_t x);
  void cplx_sqr_eq (cplx_t x);
  void cplx_rot_eq (cplx_t x);
  void cplx_flip_eq (cplx_t x);
  void cplx_add_eq (cplx_t rx, const cplx_t x);
  void cplx_sub_eq (cplx_t rx, const cplx_t x);
  void cplx_mul_eq (cplx_t rx, const cplx_t x);
  void cplx_div_eq (cplx_t rx, const cplx_t x);
  void cplx_mul_eq_d (cplx_t x, double d);
  void cplx_div_eq_d (cplx_t x, double d);
  void cplx_pow_eq_si (cplx_t x, signed long int i);

/* relational operators */
  int cplx_eq_zero (const cplx_t x);
  int cplx_eq (const cplx_t x1, const cplx_t x2);
  int cplx_ne (const cplx_t x1, const cplx_t x2);

/* I/O functions */
  int cplx_out_str_u (FILE * f, const cplx_t x);
  int cplx_out_str (FILE * f, const cplx_t x);
  int cplx_inp_str_u (cplx_t x, FILE * f);
  int cplx_inp_str (cplx_t x, FILE * f);
#define cplx_outln_str_u(F, C) cplx_out_str_u(F, C), fputc('\n', F)
#define cplx_outln_str(F, C)   cplx_out_str(F, C), fputc('\n', F)
#define cplx_out_u(C)          cplx_out_str_u(stdout, C)
#define cplx_out(C)            cplx_out_str(stdout, C)
#define cplx_outln_u(C)        cplx_out_str_u(stdout, C), putchar('\n')
#define cplx_outln(C)          cplx_out_str(stdout, C), putchar('\n')
#define cplx_inp_u(C)          cplx_inp_str_u(C, stdin)
#define cplx_inp(C)            cplx_inp_str(C, stdin)

/* vector functions */
#define cplx_valloc(N)       (cplx_t *) malloc((N) * sizeof(cplx_t))
  void cplx_vinit (cplx_t v[], long size);
/* #define cplx_vclear(V)       free(V) */
/* #define cplx_vclear(V, N)    cplx_vinit(V, N) */
#define cplx_vfree(V)        free(V)

#else

  #include <complex.h>
  typedef _Complex double cplx_t[1];

/* macros for fields access */

#define cplx_Re(X)        (creal(*X))
#define cplx_Im(X)        (cimag(*X))
#define cplx_Addr(X)      ((complex double *) X)

/* base constants */
  extern const cplx_t cplx_zero;        /* complex zero  (0, 0)    */
  extern const cplx_t cplx_one; /* complex one   (1, 0)    */
  extern const cplx_t cplx_i;   /* imag. unit    (0, 1)    */

/* initializers */
#define cplx_set(x,y) (*x = *y)
#define cplx_set_d(x,y,z) (*x = y + 1.0I * z)

  /* check floating point exceptions */
  int cplx_check_fpe (cplx_t x);

/* unary functions */
#define cplx_mod(x) (cabs(*x))
#define cplx_inv(x,y) (*x = 1 / *y)
#define cplx_sqr(x,y) (*x = csqrt(*y))

/* binary functions */
#define cplx_add(x,y,z) (*x = *y + *z)
#define cplx_sub(x,y,z) (*x = *y - *z)
#define cplx_mul(x,y,z) (*x = *y * *z)
#define cplx_div(x,y,z) (*x = *y / *z)
#define cplx_mul_d(x,y,z) (*x = *y * z)
#define cplx_div_d(x,y,z) (*x = *y / z)

#define cplx_add_eq(x,y) (*x += *y)
#define cplx_sub_eq(x,y) (*x -= *y)
#define cplx_mul_eq(x,y) (*x *= *y)
#define cplx_div_eq(x,y) (*x /= *y)
#define cplx_mul_eq_d(x,y) (*x *= y)
#define cplx_div_eq_d(x,y) (*x /= y)
#define cplx_inv_eq(x) (*x = 1.0 / *x)

/* relational operators */
#define cplx_eq_zero(x) (*x == 0.0)
#define cplx_eq(x,y) (*x == *y)
#define cplx_ne(x,y) (*x != *y)

/* I/O functions */
  int cplx_out_str_u (FILE * f, const cplx_t x);
  int cplx_out_str (FILE * f, const cplx_t x);
  int cplx_inp_str_u (cplx_t x, FILE * f);
  int cplx_inp_str (cplx_t x, FILE * f);
#define cplx_outln_str_u(F, C) cplx_out_str_u(F, C), fputc('\n', F)
#define cplx_outln_str(F, C)   cplx_out_str(F, C), fputc('\n', F)
#define cplx_out_u(C)          cplx_out_str_u(stdout, C)
#define cplx_out(C)            cplx_out_str(stdout, C)
#define cplx_outln_u(C)        cplx_out_str_u(stdout, C), putchar('\n')
#define cplx_outln(C)          cplx_out_str(stdout, C), putchar('\n')
#define cplx_inp_u(C)          cplx_inp_str_u(C, stdin)
#define cplx_inp(C)            cplx_inp_str(C, stdin)

/* vector functions */
#define cplx_valloc(N)       (cplx_t *) malloc((N) * sizeof(cplx_t))
/* #define cplx_vclear(V)       free(V) */
/* #define cplx_vclear(V, N)    cplx_vinit(V, N) */
#define cplx_vfree(V)        free(V)

#endif


/***********************************************************
**              rdpe_t type                               ** 
***********************************************************/

/* ----   definition  ---- */
  typedef struct
  {
    double m;                   /* mantissa */
    long e;                     /* exponent */
  } __rdpe_struct;

  typedef __rdpe_struct rdpe_t[1];
  typedef const __rdpe_struct *rdpe_cp;

  /* macros for fields access */
#define rdpe_Val(E)       (*E)
#define rdpe_Mnt(E)       (E -> m)
#define rdpe_Esp(E)       (E -> e)
#define rdpe_Addr(E)      ((__rdpe_struct *) E)
#define rdpe_Move(E1, E2) (*E1 = *E2)

  /* base constants */
  extern const rdpe_t rdpe_zero;        /* zero as rdpe num.       */
  extern const rdpe_t rdpe_one; /* one as rdpe num.        */
  extern const rdpe_t rdpe_maxd;        /* max double as rdpe      */
  extern const rdpe_t rdpe_mind;        /* min pos. double as rdpe */
  extern const rdpe_t RDPE_MAX; /* max rdpe number         */
  extern const rdpe_t RDPE_MIN; /* min pos. rdpe  number   */
  extern const rdpe_t RDPE_BIG;

  /* built constants */
  void rdpe_d (rdpe_t temp_rdpe, double d);
  void rdpe_2dl (rdpe_t temp_rdpe, double d, long l);

  /* assignment functions */
#define rdpe_init(E) rdpe_clear(E)
  void rdpe_clear (rdpe_t e);
  void rdpe_set (rdpe_t re, const rdpe_t e);
  void rdpe_set_d (rdpe_t e, double d);
  void rdpe_set_dl (rdpe_t e, double d, long int l);
  void rdpe_set_2dl (rdpe_t e, double d, long int l);
  int rdpe_set_str (rdpe_t e, const char *s);

  /* conversion */
  double rdpe_get_d (const rdpe_t e);
  void rdpe_get_dl (double *d, long int *l, const rdpe_t e);
  void rdpe_get_2dl (double *d, long int *l, const rdpe_t e);
  char *rdpe_get_str (char *s, const rdpe_t e);

/* unary functions */
  void rdpe_neg (rdpe_t re, const rdpe_t e);
  void rdpe_abs (rdpe_t re, const rdpe_t e);
  void rdpe_inv (rdpe_t re, const rdpe_t e);
  void rdpe_sqr (rdpe_t re, const rdpe_t e);
  void rdpe_sqrt (rdpe_t re, const rdpe_t e);
  double rdpe_log (const rdpe_t e);
  double rdpe_log10 (const rdpe_t e);
  void rdpe_exp (rdpe_t re, const rdpe_t e);

/* binary functions */
  void rdpe_add (rdpe_t re, const rdpe_t e1, const rdpe_t e2);
  void rdpe_sub (rdpe_t re, const rdpe_t e1, const rdpe_t e2);
  void rdpe_mul (rdpe_t re, const rdpe_t e1, const rdpe_t e2);
  void rdpe_div (rdpe_t re, const rdpe_t e1, const rdpe_t e2);
  void rdpe_add_d (rdpe_t re, const rdpe_t e, double d);
  void rdpe_sub_d (rdpe_t re, const rdpe_t e, double d);
  void rdpe_mul_d (rdpe_t re, const rdpe_t e, double d);
  void rdpe_mul_2exp (rdpe_t re, const rdpe_t e, unsigned long int i);
  void rdpe_div_d (rdpe_t re, const rdpe_t e, double d);
  void rdpe_div_2exp (rdpe_t re, const rdpe_t e, unsigned long int i);
  void rdpe_pow_d (rdpe_t re, const rdpe_t e, double d);
  void rdpe_pow_si (rdpe_t re, const rdpe_t e, signed long int i);

/* misc */
  void rdpe_fac_ui (rdpe_t e, unsigned long int n);
  void rdpe_swap (rdpe_t e1, rdpe_t e2);

/* op= style operators */
  void rdpe_neg_eq (rdpe_t e);
  void rdpe_abs_eq (rdpe_t e);
  void rdpe_inv_eq (rdpe_t e);
  void rdpe_sqr_eq (rdpe_t e);
  void rdpe_sqrt_eq (rdpe_t e);
  void rdpe_exp_eq (rdpe_t e);
  void rdpe_add_eq (rdpe_t re, const rdpe_t e);
  void rdpe_sub_eq (rdpe_t re, const rdpe_t e);
  void rdpe_mul_eq (rdpe_t re, const rdpe_t e);
  void rdpe_div_eq (rdpe_t re, const rdpe_t e);
  void rdpe_add_eq_d (rdpe_t e, double d);
  void rdpe_sub_eq_d (rdpe_t e, double d);
  void rdpe_mul_eq_d (rdpe_t e, double d);
  void rdpe_mul_eq_2exp (rdpe_t e, unsigned long int i);
  void rdpe_div_eq_d (rdpe_t e, double d);
  void rdpe_div_eq_2exp (rdpe_t e, unsigned long int i);
  void rdpe_pow_eq_d (rdpe_t e, double d);
  void rdpe_pow_eq_si (rdpe_t e, signed long int i);

/* relational ops */
  int rdpe_cmp (const rdpe_t e1, const rdpe_t e2);
  int rdpe_sgn (const rdpe_t e);
  int rdpe_eq_zero (const rdpe_t e);
  int rdpe_eq (const rdpe_t e1, const rdpe_t e2);
  int rdpe_ne (const rdpe_t e1, const rdpe_t e2);
  int rdpe_lt (const rdpe_t e1, const rdpe_t e2);
  int rdpe_le (const rdpe_t e1, const rdpe_t e2);
  int rdpe_gt (const rdpe_t e1, const rdpe_t e2);
  int rdpe_ge (const rdpe_t e1, const rdpe_t e2);

/* I/O functions */
  int rdpe_out_str_u (FILE * f, const rdpe_t e);
  int rdpe_out_str (FILE * f, const rdpe_t e);
  int rdpe_inp_str_u (rdpe_t e, FILE * f);
  int rdpe_inp_str (rdpe_t e, FILE * f);
  int rdpe_inp_str_flex (rdpe_t e, FILE * f);
#define rdpe_outln_str_u(F, E) rdpe_out_str_u(F, E); fputc('\n', F)
#define rdpe_outln_str(F, E)   rdpe_out_str(F, E); fputc('\n', F)
#define rdpe_out_u(E)          rdpe_out_str_u(stdout, E)
#define rdpe_out(E)            rdpe_out_str(stdout, E)
#define rdpe_outln_u(E)        rdpe_out_str_u(stdout, E); putchar('\n')
#define rdpe_outln(E)          rdpe_out_str(stdout, E); putchar('\n')
#define rdpe_inp_u(E)          rdpe_inp_str_u(e, stdin)
#define rdpe_inp(E)            rdpe_inp_str(e, stdin)

/* vector functions */
#define rdpe_valloc(N)       (rdpe_t *) malloc((N) * sizeof(rdpe_t))
  void rdpe_vinit (rdpe_t v[], long size);
/* #define rdpe_vclear(V)       free(V) */
/* #define rdpe_vclear(V, N)    rdpe_vinit(V, N) */
#define rdpe_vfree(V)        free(V)

/***********************************************************
**              gdpe_t functions                          ** 
***********************************************************/
typedef struct 
{
  rdpe_t r;
  rdpe_t eps;
  rdpe_t rel_eps;
} __gdpe_struct;

  typedef __gdpe_struct gdpe_t[1];

#define gdpe_Eps(g) ((g)->eps)
#define gdpe_Rel(g) ((g)->rel_eps)
#define gdpe_Val(g) ((g)->r)
#define gdpe_update_rel_from_abs(g) (rdpe_div (gdpe_Rel (g), gdpe_Eps (g), gdpe_Val (g)))
#define gdpe_update_abs_from_rel(g) (rdpe_mul (gdpe_Eps (g), gdpe_Rel (g), gdpe_Val (g)))

  /* Tests */
#define gdpe_eq_zero(g) (rdpe_eq_zero (gdpe_Val (g)))

#define gdpe_add_eq (g, g2) (gdpe_add ((g), (g), (g2)))
#define gdpe_sub_eq (g, g2) (gdpe_sub ((g), (g), (g2)))
#define gdpe_mul_eq (g, g2) (gdpe_mul ((g), (g), (g2)))
#define gdpe_div_eq (g, g2) (gdpe_div ((g), (g), (g2)))

  /* Binary functions */
  void gdpe_add (gdpe_t res, gdpe_t g1, gdpe_t g2);
  void gdpe_sub (gdpe_t res, gdpe_t g1, gdpe_t g2);
  void gdpe_mul (gdpe_t res, gdpe_t g1, gdpe_t g2);
  void gdpe_div (gdpe_t res, gdpe_t g1, gdpe_t g2);



/***********************************************************
**              cdpe_t functions                          ** 
***********************************************************/

/* ---- definition ---- */
  typedef struct
  {
    rdpe_t r, i;                /* re, im */
  } __cdpe_struct;

  typedef __cdpe_struct cdpe_t[1];
  typedef const __cdpe_struct *cdpe_cp;

/* macros for fields access */

#define cdpe_Val(C)       (*C)
#define cdpe_Re(C)        (C -> r)
#define cdpe_Im(C)        (C -> i)
#define cdpe_Addr(C)      ((__cdpe_struct *) C)
#define cdpe_Move(C1, C2) (*C1 = *C2)

/* base constants */
  extern const cdpe_t cdpe_zero;        /* cdpe zero     (0, 0)    */
  extern const cdpe_t cdpe_one; /* cdpe one      (1, 0)    */
  extern const cdpe_t cdpe_i;   /* cdpe I        (0, 1)    */

/* built constants */
  void cdpe_d (cdpe_t temp_cdpe, double r, double i);
  void cdpe_x (cdpe_t temp_cdpe, const cplx_t x);
  void cdpe_e (cdpe_t temp_cdpe, const rdpe_t er, const rdpe_t ei);
  void cdpe_2dl (cdpe_t temp_cdpe, double dr, long lr, double di, long li);

/* initializers */
#define cdpe_init(C) cdpe_clear(C)
  void cdpe_clear (cdpe_t c);
  void cdpe_set (cdpe_t rc, const cdpe_t c);
  void cdpe_set_e (cdpe_t c, const rdpe_t er, const rdpe_t ei);
  void cdpe_set_x (cdpe_t c, const cplx_t x);
  void cdpe_set_d (cdpe_t c, double dr, double di);
  void cdpe_set_dl (cdpe_t c, double dr, long int lr, double di, long int li);
  void cdpe_set_2dl (cdpe_t c, double dr, long int lr,
                     double di, long int li);
  int cdpe_set_str (cdpe_t c, const char *s);

/* conversion */
  void cdpe_get_e (rdpe_t er, rdpe_t ei, const cdpe_t c);
  void cdpe_get_x (cplx_t x, const cdpe_t c);
  void cdpe_get_d (double *dr, double *di, const cdpe_t c);
  char *cdpe_get_str (char *s, const cdpe_t c);

/* unary functions */
  void cdpe_neg (cdpe_t rc, const cdpe_t c);
  void cdpe_con (cdpe_t rc, const cdpe_t c);
  void cdpe_smod (rdpe_t e, const cdpe_t c);
  void cdpe_mod (rdpe_t e, const cdpe_t c);
  void cdpe_inv (cdpe_t rc, const cdpe_t c);
  void cdpe_sqr (cdpe_t rc, const cdpe_t c);
  void cdpe_rot (cdpe_t rc, const cdpe_t c);
  void cdpe_flip (cdpe_t rc, const cdpe_t c);

/* binary functions */
  void cdpe_add (cdpe_t rc, const cdpe_t c1, const cdpe_t c2);
  void cdpe_sub (cdpe_t rc, const cdpe_t c1, const cdpe_t c2);
  void cdpe_mul (cdpe_t rc, const cdpe_t c1, const cdpe_t c2);
  void cdpe_div (cdpe_t rc, const cdpe_t c1, const cdpe_t c2);
  void cdpe_mul_e (cdpe_t rc, const cdpe_t c, const rdpe_t e);
  void cdpe_mul_x (cdpe_t rc, const cdpe_t c, const cplx_t x);
  void cdpe_mul_d (cdpe_t rc, const cdpe_t c, double d);
  void cdpe_mul_2exp (cdpe_t rc, const cdpe_t c, unsigned long int i);
  void cdpe_div_e (cdpe_t rc, const cdpe_t c, const rdpe_t e);
  void cdpe_div_d (cdpe_t rc, const cdpe_t c, double d);
  void cdpe_div_2exp (cdpe_t rc, const cdpe_t c, unsigned long int i);

/* misc */
  void cdpe_pow_si (cdpe_t rc, const cdpe_t c, signed long int i);

/* op= style operators */
  void cdpe_neg_eq (cdpe_t c);
  void cdpe_con_eq (cdpe_t c);
  void cdpe_inv_eq (cdpe_t c);
  void cdpe_sqr_eq (cdpe_t c);
  void cdpe_rot_eq (cdpe_t c);
  void cdpe_flip_eq (cdpe_t c);
  void cdpe_add_eq (cdpe_t rc, const cdpe_t c);
  void cdpe_sub_eq (cdpe_t rc, const cdpe_t c);
  void cdpe_mul_eq (cdpe_t rc, const cdpe_t c);
  void cdpe_div_eq (cdpe_t rc, const cdpe_t c);
  void cdpe_mul_eq_e (cdpe_t c, const rdpe_t e);
  void cdpe_mul_eq_x (cdpe_t c, const cplx_t x);
  void cdpe_mul_eq_d (cdpe_t c, double d);
  void cdpe_mul_eq_2exp (cdpe_t c, unsigned long int i);
  void cdpe_div_eq_e (cdpe_t c, const rdpe_t e);
  void cdpe_div_eq_d (cdpe_t c, double d);
  void cdpe_div_eq_2exp (cdpe_t c, unsigned long int i);
  void cdpe_pow_eq_si (cdpe_t c, signed long int i);
  void cdpe_swap (cdpe_t c1, cdpe_t c2);

/* relational ops */
  int cdpe_eq_zero (const cdpe_t c);
  int cdpe_eq (const cdpe_t c1, const cdpe_t c2);
  int cdpe_ne (const cdpe_t c1, const cdpe_t c2);

/* I/O functions */
  int cdpe_out_str_u (FILE * f, const cdpe_t c);
  int cdpe_out_str (FILE * f, const cdpe_t c);
  int cdpe_inp_str_u (cdpe_t c, FILE * f);
  int cdpe_inp_str (cdpe_t c, FILE * f);
#define cdpe_outln_str_u(F, C) cdpe_out_str_u(F, C); fputc('\n', F)
#define cdpe_outln_str(F, C)   cdpe_out_str(F, C); fputc('\n', F)
#define cdpe_out_u(C)          cdpe_out_str_u(stdout, C)
#define cdpe_out(C)            cdpe_out_str(stdout, C)
#define cdpe_outln_u(C)        cdpe_out_str_u(stdout, C); putchar('\n')
#define cdpe_outln(C)          cdpe_out_str(stdout, C); putchar('\n')
#define cdpe_inp_u(C)          cdpe_inp_str_u(C, stdin)
#define cdpe_inp(C)            cdpe_inp_str(C, stdin)

/* vector functions */
#define cdpe_valloc(N)       (cdpe_t *) malloc((N) * sizeof(cdpe_t))
  void cdpe_vinit (cdpe_t v[], long size);
/* #define cdpe_vclear(V)       free(C) */
/* #define cdpe_vclear(V, N)    cdpe_vinit(V, N) */
#define cdpe_vfree(V)        free(V)

/*
 * End of extern "C" {
 *   ...
 * }
 */
#ifdef __cplusplus
}
#endif

#endif

/***********************************************************
**                                                        **
***********************************************************/