Overview
Comment:Fixed stupid typo in max and min functions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/merging-ode2odes-exe | trunk
Files: files | file ages | folders
SHA3-256: 85aff985743eecd126d155eae5a2e66b98f6d41e2d5bd22bc3bafdb21d9c2577
User & Date: geraint@users.sourceforge.net on 2001-03-02 00:40:18
Other Links: branch diff | manifest | tags
Context
2001-03-02
00:45:21
Separated Euler and Implicit methods in .cc code and dependencies. check-in: 851c0ce75e user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk
00:40:18
Fixed stupid typo in max and min functions. check-in: 85aff98574 user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk
2001-03-01
05:05:53
Minor revisions. check-in: 5d613c5596 user: geraint@users.sourceforge.net tags: origin/merging-ode2odes-exe, trunk
Changes

Modified mttroot/mtt/cc/include/useful-functions.hh from [c0b27c8721] to [f8dd1f5d60].

1
2
3


4
5
6
7













8
9
10
11


12
13

14









15
16
17
18
19
20
21
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



+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+


-
-
+
+

-
+

+
+
+
+
+
+
+
+
+







#ifndef HAVE_USEFUL_FUNCTIONS_HH
#define HAVE_USEFUL_FUNCTIONS_HH


#ifdef __CPLUSPLUS
template <class T>
inline T max (const T &x1, const T &x2)
{
  return (x1 >= x2) ? x1 : (x2 < x1) ? x2 : 0;
template <class class_t>
#else
#define inline			// strip from pre-processed file
#define class_t double
#endif // __CPLUSPLUS


// == Template functions ==

inline class_t
max (const class_t &x1, const class_t &x2)
{
  return ((x1 >= x2) ? x1 : (x1 < x2) ? x2 : 0);
}

template <class T>
inline T min (const T &x1, const T &x2)
inline class_t
min (const class_t &x1, const class_t &x2)
{
  return (x1 <= x2) ? x1 : (x2 > x1) ? x2 : 0;
  return ((x1 <= x2) ? x1 : (x1 > x2) ? x2 : 0);
}

inline class_t
sign (const class_t &x)
{
  return ((x > 0) ? +1 : (x < 0) ? -1 : 0);
}


// == Octave functions ==

inline Matrix
ones (const int r = 1, const int c = 1)
{
  Matrix m (r, c, 1.0);
  return m;
}
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
71
72
73
74
75
76
77










78







-
-
-
-
-
-
-
-
-
-

inline Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c, 0.0);
  return m;
}

template <class T>
inline int
sign (T x)
{
  return
    (0 < x) ? +1 :
    (0 > x) ? -1 :
    0;
}

#endif // HAVE_USEFUL_FUNCTIONS_HH


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