Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/09 12:48:10 (15 years ago)
Author:
gkronber
Message:

Added methods to get min and max value of a column in a given range. #695 (Dataset should have methods to get min and max element of a column in a given range)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs

    r2038 r2144  
    304304
    305305    public double GetMaximum(int column) {
     306      return GetMaximum(column, 0, Rows);
     307    }
     308
     309    public double GetMaximum(int column, int start, int end) {
    306310      double max = Double.NegativeInfinity;
    307       for (int i = 0; i < Rows; i++) {
     311      for (int i = start; i < end; i++) {
    308312        double val = GetValue(i, column);
    309313        if (!double.IsNaN(val) && val > max) max = val;
     
    313317
    314318    public double GetMinimum(int column) {
     319      return GetMinimum(column, 0, Rows);
     320    }
     321
     322    public double GetMinimum(int column, int start, int end) {
    315323      double min = Double.PositiveInfinity;
    316       for (int i = 0; i < Rows; i++) {
     324      for (int i = start; i < end; i++) {
    317325        double val = GetValue(i, column);
    318326        if (!double.IsNaN(val) && val < min) min = val;
Note: See TracChangeset for help on using the changeset viewer.