about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/gis/saga/finite-6.3.0.patch
blob: 91c9543edfdadb425df51cd910b21890d0e07cfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/src/tools/imagery/imagery_maxent/me.cpp b/src/tools/imagery/imagery_maxent/me.cpp
index c5da854..d3e9cff 100755
--- a/src/tools/imagery/imagery_maxent/me.cpp
+++ b/src/tools/imagery/imagery_maxent/me.cpp
@@ -21,7 +21,7 @@
 #ifdef _SAGA_MSW
 #define isinf(x) (!_finite(x))
 #else
-#define isinf(x) (!finite(x))
+#define isinf(x) (!isfinite(x))
 #endif
 
 /** The input array contains a set of log probabilities lp1, lp2, lp3
@@ -47,7 +47,7 @@ double sumLogProb(vector<double>& logprobs)
 /** returns log (e^logprob1 + e^logprob2). */
 double sumLogProb(double logprob1, double logprob2)
 {
-  if (isinf(logprob1) && isinf(logprob2)) 
+  if (isinf(logprob1) && isinf(logprob2))
     return logprob1; // both prob1 and prob2 are 0, return log 0.
   if (logprob1>logprob2)
     return logprob1+log(1+exp(logprob2-logprob1));
@@ -70,8 +70,8 @@ void MaxEntModel::print(ostream& ostrm, MaxEntTrainer& trainer)
   for (FtMap::iterator it = _index.begin(); it!=_index.end(); it++) {
     unsigned long i = it->second;
     for (unsigned long c = 0; c<_classes; c++) {
-      ostrm << "lambda(" << trainer.className(c) << ", " 
-	    << trainer.getStr(it->first) << ")=" 
+      ostrm << "lambda(" << trainer.className(c) << ", "
+	    << trainer.getStr(it->first) << ")="
 	    << _lambda[i+c] << endl;
     }
   }
@@ -86,7 +86,7 @@ int MaxEntModel::getProbs(MaxEntEvent& event, vector<double>& probs)
     double s = 0;
     for (unsigned int f = 0; f<event.size(); f++) {
       FtMap::iterator it = _index.find(event[f]);
-      if (it!=_index.end()) 
+      if (it!=_index.end())
 	s += _lambda[it->second+c];
     }
     probs[c] = s;
@@ -142,10 +142,10 @@ double MaxEntModel::getObsCounts(EventSet& events, vector<double>& obsCounts)
     double ftSum = 0;
     for (unsigned long j=0; j<e.size(); j++) {
       FtMap::iterator it = _index.find(e[j]);
-      if (it!=_index.end()) 
+      if (it!=_index.end())
 	obsCounts[it->second+c] += count;
       else { // new feature, need to expand obsCounts and _lambda
-	for (unsigned int k = 0; k<_classes; k++) 
+	for (unsigned int k = 0; k<_classes; k++)
 	  obsCounts.push_back(0);
 	obsCounts[_lambda.size()+c] += count;
 	addFeature(e[j]);