/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/Common/IpUtils.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2007 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpUtils.hpp 984 2007-05-30 23:03:22Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPUTILS_HPP__
00010 #define __IPUTILS_HPP__
00011 
00012 // Standard Ip Include Files
00013 #include "IpTypes.hpp"
00014 #include "IpDebug.hpp"
00015 
00016 namespace Ipopt
00017 {
00018 
00019   inline Index Max(Index a, Index b)
00020   {
00021     return ((a) > (b) ? (a) : (b));
00022   }
00023 
00024   inline Index Max(Index a, Index b, Index c)
00025   {
00026     Index max = Max(a,b);
00027     max = Max(max, c);
00028     return max;
00029   }
00030 
00031   inline Index Max(Index a, Index b, Index c, Index d)
00032   {
00033     Index max = Max(a, b, c);
00034     max = Max(max, d);
00035     return max;
00036   }
00037 
00038   inline Index Min(Index a, Index b)
00039   {
00040     return ((a) < (b) ? (a) : (b));
00041   }
00042 
00043   inline Index Min(Index a, Index b, Index c)
00044   {
00045     Index min = Min(a,b);
00046     min = Min(min, c);
00047     return min;
00048   }
00049 
00050   inline Index Min(Index a, Index b, Index c, Index d)
00051   {
00052     Index min = Min(a, b, c);
00053     min = Min(min, d);
00054     return min;
00055   }
00056 
00058 
00059   inline Number Max(Number a, Number b)
00060   {
00061     return ((a) > (b) ? (a) : (b));
00062   }
00063 
00064   inline Number Max(Number a, Number b, Number c)
00065   {
00066     Number max = Max(a,b);
00067     max = Max(max, c);
00068     return max;
00069   }
00070 
00071   inline Number Max(Number a, Number b, Number c, Number d)
00072   {
00073     Number max = Max(a, b, c);
00074     max = Max(max, d);
00075     return max;
00076   }
00077 
00078   inline Number Min(Number a, Number b)
00079   {
00080     return ((a) < (b) ? (a) : (b));
00081   }
00082 
00083   inline Number Min(Number a, Number b, Number c)
00084   {
00085     Number min = Min(a,b);
00086     min = Min(min, c);
00087     return min;
00088   }
00089 
00090   inline Number Min(Number a, Number b, Number c, Number d)
00091   {
00092     Number min = Min(a, b, c);
00093     min = Min(min, d);
00094     return min;
00095   }
00096 
00099   bool IsFiniteNumber(Number val);
00100 
00102   Number IpRandom01();
00103 
00105   void IpResetRandom01();
00106 
00107 } //namespace Ipopt
00108 
00109 #endif

Generated on Sun Nov 14 14:06:35 2010 for Coin-All by  doxygen 1.4.7