Changeset 8076:3a03c9d673eb in orange


Ignore:
Timestamp:
07/05/11 15:45:01 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
4a2eaab19f1088a9f9d2c80a67b78219b497235f
Message:

Fixed compiling with Visual C++.

Location:
source/orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/earth.cpp

    r8074 r8076  
    6565     - Added defines for STANDALONE, USING_BLAS, _DEBUG 
    6666     - Removed  #include <crtdbg.h> for windows 
     67     - Fix defines for ISNAN and FINITE to work on non MSC compilers 
    6768     - Removed debugging code for windows 
    6869     - Removed definitions of bool, true false 
     
    7172     - Replaced POS_INF static global variable with numeric_limits<double>::infinity() 
    7273     - Added #include <limits> 
     74     - Changed include of earth.h to earth.ppp and moved it before the module level defines 
    7375 
    7476    - TODO: Move global vars inside the functions using them (most are local) 
    7577 */ 
    76  
    77  
    78 #define STANDALONE 1 
    79 #define USING_BLAS 1 
    80 #define _DEBUG 0 
    81  
    82 #if !STANDALONE 
    83 #define USING_R 1 
    84 #endif // STANDALONE 
    8578 
    8679#include <stdlib.h> 
     
    9184#include <math.h> 
    9285#include <limits> 
     86 
     87#include "earth.ppp" 
     88 
     89#define STANDALONE 1 
     90#define USING_BLAS 1 
     91#define _DEBUG 0 
     92 
     93#if !STANDALONE 
     94#define USING_R 1 
     95#endif // STANDALONE 
     96 
    9397 
    9498#if _MSC_VER && _DEBUG 
     
    123127    #define warning printf 
    124128    extern "C" { void error(const char *args, ...); } 
    125     #define ISNAN(x)  isnan(x) 
    126     #define FINITE(x) finite(x) 
     129    #ifdef _MSC_VER 
     130        #define ISNAN(x)  _isnan(x) 
     131        #define FINITE(x) _finite(x) 
     132    #else 
     133        #define ISNAN(x)  isnan(x) 
     134        #define FINITE(x) finite(x) 
     135    #endif // _MSC_VER 
     136 
    127137    #define ASSERT(x)   \ 
    128138        if (!(x)) error("internal assertion failed in file %s line %d: %s\n", \ 
     
    130140#endif 
    131141 
    132 #include "earth.ppp" 
     142//#include "earth.h" 
    133143 
    134144extern _C_ int dqrdc2_(double *x, int *ldx, int *n, int *p, 
     
    12591269 
    12601270    if (nTerms == 0) {          // column 0, the intercept 
    1261         double len = 1 / sqrt(nCases); 
     1271        double len = 1 / sqrt((double) nCases); 
    12621272        bxOrthMean[0] = len; 
    12631273        for (iCase = 0; iCase < nCases; iCase++) 
     
    29822992    max_terms = 21; 
    29832993    max_degree = 1; 
    2984     penalty = (max_degree > 1)? 3: 2; 
     2994    penalty = (max_degree > 1)? 3.0: 2.0; 
    29852995    threshold = 0.001; 
    29862996    prune = true; 
     
    30223032    double *weights = NULL; 
    30233033 
     3034    // Redefine x indexing 
     3035    #undef x_ 
    30243036    #define x_(i, j) x[i + j * num_cases] 
    30253037 
    30263038    TExampleGenerator::iterator ex_iter = examples->begin(); 
    3027     for (int i=0; i<num_cases; i++, ex_iter++) 
     3039    for (int i=0; i<num_cases; i++, ++ex_iter) 
    30283040    { 
    30293041        TExample &example = *ex_iter; 
     
    31013113} 
    31023114 
     3115double round(double r) 
     3116{ 
     3117    return floor(r + 0.5); 
     3118} 
     3119 
    31033120TValue TEarthClassifier::operator()(const TExample& example) 
    31043121{ 
  • source/orange/earth.hpp

    r8069 r8076  
    167167 */ 
    168168 
     169#undef STANDALONE 
     170#undef USING_R 
     171 
    169172#include "classify.hpp" 
    170173#include "learn.hpp" 
Note: See TracChangeset for help on using the changeset viewer.