- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/SVN-release/Ipopt-3.7.1/Ipopt/src/Common/IpUtils.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2009 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Common Public License.
    00004 //
    00005 // $Id: IpUtils.hpp 1521 2009-07-15 22:26:15Z 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
    00108   Number CpuTime();
    00109
    00111   double WallclockTime();
    00112
    00117   bool Compare_le(Number lhs, Number rhs, Number BasVal);
    00118
    00121   int Snprintf(char* str, long size, const char* format, ...);
    00122
    00123 } //namespace Ipopt
    00124
    00125 #endif