Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tntmath.h
1 /*
2 This file is distributed as part of the BIAS library (Basic ImageAlgorithmS)
3 but it has not been developed by the authors of BIAS.
4 
5 For copyright, author and license information see below.
6 */
7 
8 
9 /*
10 *
11 * Template Numerical Toolkit (TNT): Linear Algebra Module
12 *
13 * Mathematical and Computational Sciences Division
14 * National Institute of Technology,
15 * Gaithersburg, MD USA
16 *
17 *
18 * This software was developed at the National Institute of Standards and
19 * Technology (NIST) by employees of the Federal Government in the course
20 * of their official duties. Pursuant to title 17 Section 105 of the
21 * United States Code, this software is not subject to copyright protection
22 * and is in the public domain. The Template Numerical Toolkit (TNT) is
23 * an experimental system. NIST assumes no responsibility whatsoever for
24 * its use by other parties, and makes no guarantees, expressed or implied,
25 * about its quality, reliability, or any other characteristic.
26 *
27 * BETA VERSION INCOMPLETE AND SUBJECT TO CHANGE
28 * see http://math.nist.gov/tnt for latest updates.
29 *
30 */
31 
32 
33 
34 // Header file for scalar math functions
35 
36 #ifndef TNTMATH_H
37 #define TNTMATH_H
38 
39 // conventional functions required by several matrix algorithms
40 
41 // min and max macros are defined in WIN32, collision results
42 #ifdef WIN32
43 #undef min
44 #undef max
45 #endif //WIN32
46 
47 namespace TNT
48 {
49 
50  inline double abs(double t)
51  {
52  return ( t > 0 ? t : -t);
53  }
54 
55  inline double min(double a, double b)
56  {
57  return (a < b ? a : b);
58  }
59 
60  inline double max(double a, double b)
61  {
62  return (a > b ? a : b);
63  }
64 
65  // JW 04/23/2002
66  inline double max(int a, int b)
67  {
68  return (a > b ? a : b);
69  }
70 
71  // JMF 01/27/2003
72  inline double min(int a, int b)
73  {
74  return (a < b ? a : b);
75  }
76 
77  inline float abs(float t)
78  {
79  return ( t > 0 ? t : -t);
80  }
81 
82  inline float min(float a, float b)
83  {
84  return (a < b ? a : b);
85  }
86 
87  inline float max(float a, float b)
88  {
89  return (a > b ? a : b);
90  }
91 
92  inline double sign(double a)
93  {
94  return (a > 0 ? 1.0 : -1.0);
95  }
96 
97 
98 
99  inline float sign(float a)
100  {
101  return (a > 0.0 ? 1.0f : -1.0f);
102  }
103 
104 } /* namespace TNT */
105 
106 
107 #endif
108 /* TNTMATH_H */
109 
double max(double a, double b)
Definition: tntmath.h:60
double sign(double a)
Definition: tntmath.h:92
double min(double a, double b)
Definition: tntmath.h:55
double abs(double t)
Definition: tntmath.h:50