Overview
Comment:Simplified.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 746df31cd63e8ee81c49cab346f6da58123420359c4836d13c26fdca29fb2681
User & Date: geraint@users.sourceforge.net on 2001-02-05 04:23:09
Other Links: branch diff | manifest | tags
Context
2001-02-05
04:32:35
Octave version 2.1.x compatability and #ifdef statements for standalone rep check-in: 836eaf9473 user: geraint@users.sourceforge.net tags: origin/master, trunk
04:23:09
Simplified. check-in: 746df31cd6 user: geraint@users.sourceforge.net tags: origin/master, trunk
04:16:06
Prevent match of zero occurences of a letter between "mtt" and a digit.
Fixes bug #116426.
check-in: b70e3384ec user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/cc/include/useful-functions.hh from [8f3b0557d9] to [bc3e893dc8].

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




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


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




-
+
-
-
-
-














+
+
-
-
+
+
+
+
+
-
+





-
+
-
-
-






-
+
-
-
-
-












-
-
// $Id$
// $Log$
// Revision 1.1  2000/11/28 04:50:29  geraint
// Initial revision

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

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

inline Matrix
ones (const int r = 1, const int c = 1)
{
  Matrix m (r, c);
  Matrix m (r, c, 1.0);
  register int i, j;
  for (i = 0; i < r; i++)
    for (j = 0; j < c; j++)
      m (i, j) = 1.0;
  return m;
}

inline ColumnVector
nozeros (const ColumnVector v0, const double tol = 0.0)
{
  ColumnVector v (v0.length ());
  register int i, j;
  for (i = j = 0; i < v.length (); i++)
    if (tol < abs (v0 (i)))
      {
	v (j) = v0 (i);
	j++;
      }
  if (0 == j)
    {
  return (j)
    ? (v.extract (0, --j))
      return *new ColumnVector ();
    }
  else
    {
      return (v.extract (0, --j));
    : 0x0;
    }
}

inline ColumnVector
zeros (const int r)
{
  ColumnVector v (r);
  ColumnVector v (r, 0.0);
  register int i;
  for (i = 0; i < r; i++)
    v (i) = 0.0;
  return v;
}

inline Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c);
  Matrix m (r, c, 0.0);
  register int i, j;
  for (i = 0; i < r; i++)
    for (j = 0; j < c; j++)
      m (i, j) = 0.0;
  return m;
}

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



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