Main Page | Namespace List | Class Hierarchy | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

general.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (c) 2003, Cornell University
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009    - Redistributions of source code must retain the above copyright notice,
00010        this list of conditions and the following disclaimer.
00011    - Redistributions in binary form must reproduce the above copyright
00012        notice, this list of conditions and the following disclaimer in the
00013        documentation and/or other materials provided with the distribution.
00014    - Neither the name of Cornell University nor the names of its
00015        contributors may be used to endorse or promote products derived from
00016        this software without specific prior written permission.
00017 
00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00028 THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030 */
00031 
00032 #if !defined _GENERAL_H
00033 #define _GENERAL_H
00034 
00035 // uncoment the following if debugin
00036 #define    DEBUGON
00037 
00038 // uncomment to print lots of debug messages
00039 // #define DEBUG_PRINT
00040 
00041 // uncomment the following if XML is used
00042 // #define CLUS_USE_XML
00043 
00044 //#define TNT_BOUNDS_CHECK
00045 
00046 #if defined(DEBUGON)
00047 // class ostream;
00048 // class istream;
00049 #include <iostream>
00050 #endif
00051 
00052 #define LAMBDA_PREC          1.0E-5
00053 #define PREC_ARITM           1.0E-7
00054 #define TNNearlyZero         1E-05
00055 #define Real                 double
00056 #define JacobiTolerance      1.0e-6
00057 #define MaxIterations        50
00058 #define MAXREAL              1.0e+100
00059 #define MINREAL              -1.0e+100
00060 #define BLKSIZE              4096
00061 #define BIG_NR               1000000
00062 #define SMALL_POZ_VALUE      3.0E-13
00063 #define LARGE_POZ_VALUE      3.0E+100
00064 #define MAX_CATEGORIES       10000
00065 #define MAX_VARIABLES        1000
00066 
00067 #if !defined INT_MAX
00068 #define INT_MAX              2147483647
00069 #endif
00070 
00071 /* error values return by some functions */
00072 #define    EBADDIM            1
00073 
00074 
00075 #define NonEqual(X,Y)         ( (fabs(X)+fabs(Y))==0.0?0:NonZero((X-Y)/(fabs(X)+fabs(Y))) )
00076 #define IsEqual(X,Y)          ( (fabs(X)+fabs(Y))==0.0?1:IsZero((X-Y)/(fabs(X)+fabs(Y))) )
00077 #define NonZero(X)            ( ( (X)>TNNearlyZero ) || ( (X)<-TNNearlyZero ) )
00078 #define IsZero(X)             ( ( (X)<TNNearlyZero ) && ( (X)>-TNNearlyZero ) )
00079 #define NonZeroM(X)           ( ( (X)>TNNearlyZero*100 ) || ( (X)<-TNNearlyZero*100 ) )
00080 
00081 #define RANDOM01FLOAT         ( (1.0*rand())/RAND_MAX )
00082 
00083 #if defined(DEBUGON)
00084 #define ExitIf( Cond, Text )     if ( Cond ) { \
00085                                     cout <<  Text << endl; \
00086                                     exit(1); \
00087                                  }
00088 #elif
00089 #define ExitIf( Cond, Text )
00090 #endif
00091 
00092 // #define pow2(x)    ((x)*(x))
00093 inline double pow2(double x)
00094 {
00095     return x*x;
00096 }
00097 
00098 #endif /* _GENERAL_H */

Generated on Mon Jul 21 16:57:24 2003 for SECRET by doxygen 1.3.2