Overview
Comment:Made file C compliant.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 27de151df7b13b2b65e022573d789f7c66dcb23caefcd2a240f1e31f14d9a096
User & Date: geraint@users.sourceforge.net on 2002-05-29 18:40:43
Other Links: branch diff | manifest | tags
Context
2002-06-05
10:54:12
#include "useful-functions.hh" added to files. check-in: e168fd1202 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-05-29
18:40:43
Made file C compliant. check-in: 27de151df7 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-05-28
22:52:48
Starting to move rep into single file. check-in: 5cb35287c8 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/cc/include/useful-functions.hh from [3f974211f8] to [381e0e03ee].

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

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
-







+
+
+
+
+
+
-
+
-




-
+





-
+





-
+





-
+



-
+







//#define pi 3.14159 // Predefine pi

#ifndef HAVE_USEFUL_FUNCTIONS_HH
#define HAVE_USEFUL_FUNCTIONS_HH


#ifndef __cplusplus
#define inline			/* strip */
#define cast_to_double	(double)
typedef unsigned int bool;
const bool true = 1;
const bool false = 0;
#else
#define cast_to_double	static_cast<double>
#endif // ! __cplusplus
#endif /* ! __cplusplus */


static inline double
max (const double x1, const double x2)
{
  return static_cast<double>((x1 >= x2) ? x1 : (x1 < x2) ? x2 : 0);
  return cast_to_double ((x1 >= x2) ? x1 : (x1 < x2) ? x2 : 0);
}

static inline double
min (const double x1, const double x2)
{
  return static_cast<double>((x1 <= x2) ? x1 : (x1 > x2) ? x2 : 0);
  return cast_to_double ((x1 <= x2) ? x1 : (x1 > x2) ? x2 : 0);
}

static inline double
nonsingular (const double x)
{
  return static_cast<double>((x == 0) ? 1.0e-30 : x);
  return cast_to_double ((x == 0) ? 1.0e-30 : x);
}

static inline double
sign (const double x)
{
  return static_cast<double>((x > 0) ? +1 : (x < 0) ? -1 : 0);
  return cast_to_double ((x > 0) ? +1 : (x < 0) ? -1 : 0);
}


// Octave functions
/* Octave functions */
#ifdef __cplusplus
static Matrix
ones (const int r = 1, const int c = 1)
{
  Matrix m (r, c, 1.0);
  return m;
}
73
74
75
76
77
78
79
80

81
82
83
84

77
78
79
80
81
82
83

84
85
86
87

88







-
+



-
+

static Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c, 0.0);
  return m;
}
#endif // __cplusplus
#endif /* __cplusplus */



#endif // HAVE_USEFUL_FUNCTIONS_HH
#endif /* HAVE_USEFUL_FUNCTIONS_HH */


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]