/home/coin/SVN-release/OS-2.0.0/OS/src/OSUtils/OSMathUtil.h

Go to the documentation of this file.
00001 /* $Id: OSMathUtil.h 2698 2009-06-09 04:14:07Z kmartin $ */
00022 #ifndef MATHUTIL_H
00023 #define MATHUTIL_H
00024  
00025 #include "OSParameters.h"
00026 #include "OSdtoa.h"
00027 #include "OSErrorClass.h"
00028 #include "OSDataStructures.h"
00029 
00030 
00031 #include <sstream>  
00032 #include<string>
00033 
00034 
00035 #ifdef __cplusplus
00036 extern "C" std::string os_dtoa_format(double  x);
00037 extern "C" double os_strtod_wrap(const char *str,   char **strEnd);
00038 #else
00039 #ifdef __STDC__
00040 std::string os_dtoa_format(double  x);
00041 double os_strtod_wrap(const char *str,  char **strEnd);
00042 #endif
00043 #endif 
00044 
00045 
00046 using std::ostringstream; 
00047 
00060 class MathUtil{
00061         public:
00062 
00064         MathUtil();
00065         
00067         ~MathUtil();
00068         
00076         /*public static double round (double x, int precision){
00077                 double mask = 0.0, y, result;           
00078                 try{
00079                         mask = Math.pow (10.0, -(double)precision);
00080                 }
00081                 catch(ArithmeticException e){
00082                         return x;
00083                 }
00084                 y  = mod(x, mask);
00085                 result  = x - y;
00086                 if (y / mask >= 0.5) result += mask;
00087                 return result;
00088         }//round
00089         */
00097         /*public static double mod (double x, double y){
00098                 return  x - Math.floor(x / y) * y;
00099         }//mod
00100         */
00115         static SparseMatrix* convertLinearConstraintCoefficientMatrixToTheOtherMajor(
00116                         bool isColumnMajor, int startSize, int valueSize, int* start, int* index, 
00117                         double* value, int dimension);
00118         
00124         std::string format_os_dtoa( double x);
00125         
00126         
00135         //double os_strtod_wrap(const char *str) throw(ErrorClass);
00136         
00145         //double os_strtod_wrap(const char *str,  const char *strEnd) throw(ErrorClass);
00146                         
00147 };//class MathUtil
00148 #endif

Generated on Mon Aug 3 03:02:25 2009 by  doxygen 1.4.7