OSDN Git Service

modified eosBayesDistributionInitialProbabilitySet.c v2.3.9p0199
author久永浩司 <hisanagakouji@hisanagakouji-no-MacBook-Air.local>
Sat, 21 Jan 2017 15:40:22 +0000 (00:40 +0900)
committer久永浩司 <hisanagakouji@hisanagakouji-no-MacBook-Air.local>
Sat, 21 Jan 2017 15:40:22 +0000 (00:40 +0900)
src/Objects/General/eosBayes/src/eosBayesDistributionInitialProbabilitySet.c

index f801b9b..8cc8b60 100644 (file)
@@ -134,10 +134,14 @@ void eosBayesProbabilityRangeChange(eosBayes* d, int n, float percentage, int mo
          total  = d->posterior[i].probofmaxposterior;
          DEBUGPRINT1("start total:%f\n",total);  
          for(j=1;total<=percentage;j++){
-               iofmin  =  d->posterior[i].iofmaxposterior-j;
-               iofmax  = d->posterior[i].iofmaxposterior+j;
-               total  += d->posterior[i].prob[iofmax];
-               total  +=  d->posterior[i].prob[iofmin];
+               if(d->posterior[i].iofmaxposterior-j >= 0){
+                 iofmin  =  d->posterior[i].iofmaxposterior-j;
+                 total  +=  d->posterior[i].prob[iofmin];      
+               }
+               if(d->posterior[i].iofmaxposterior+j <= d->posterior[i].n){
+                 iofmax  = d->posterior[i].iofmaxposterior+j;
+                 total  += d->posterior[i].prob[iofmax];
+               }
                DEBUGPRINT1("end total:%f\n",total);
          }