Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1926


Ignore:
Timestamp:
05/28/09 15:26:49 (15 years ago)
Author:
mkommend
Message:

corrected too large creation of values array by resizing (ticket #515)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification.ConditionalEvaluation/3.3/ConditionalEvaluatorBase.cs

    r1916 r1926  
    5151        // check if condition variable is true between sample - minTimeOffset and sample - maxTimeOffset
    5252        bool skip = false;
    53         for (int checkIndex = sample + minTimeOffset; checkIndex <= sample + maxTimeOffset && !skip ; checkIndex++) {
     53        for (int checkIndex = sample + minTimeOffset; checkIndex <= sample + maxTimeOffset && !skip; checkIndex++) {
    5454          if (dataset.GetValue(checkIndex, conditionVariable) == 0) {
    5555            skip = true;
     
    6363            dataset.SetValue(sample, targetVariable, estimated);
    6464          }
    65           values[sample - start, 0] = estimated;
    66           values[sample - start, 1] = original;
     65          values[sample - start - skippedSampels, 0] = estimated;
     66          values[sample - start - skippedSampels, 1] = original;
    6767        }
    6868      }
     69      //needed because otherwise the array is too larged dimension and therefore the sample count is false during calculation
     70      ResizeArray(ref values, 2, end - start - skippedSampels);
    6971
    7072
     
    7880      }
    7981      qualityData.Data = quality;
    80       scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= skippedSampels;
     82      scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data -= skippedSampels;
     83    }
     84
     85
     86    private void ResizeArray(ref double[,] original, int cols, int rows) {
     87      double[,] newArray = new double[rows, cols];
     88      Array.Copy(original, newArray, cols * rows);
     89      original = newArray;
    8190    }
    8291
Note: See TracChangeset for help on using the changeset viewer.