- Timestamp:
- 09/06/14 00:38:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs
r11313 r11348 38 38 /// <returns>An sequence of values from start to end (inclusive)</returns> 39 39 public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth) { 40 if (start > end) throw new ArgumentException("start must be less than or equal end."); 41 if (stepWidth <= 0) throw new ArgumentException("stepwith must be larger than zero.", "stepWidth"); 40 if (stepWidth.IsAlmost(0)) 41 throw new ArgumentException("The step width cannot be zero."); 42 if (start < end && stepWidth < 0) 43 throw new ArgumentException("The step width must be larger than zero for increasing sequences (start < end)."); 44 if (start > end && stepWidth > 0) 45 throw new ArgumentException("The step width must be smaller than zero for decreasing sequences (start > end)."); 42 46 double x = start; 43 47 // x<=end could skip the last value because of numerical problems … … 68 72 /// <returns></returns> 69 73 public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth, Func<double, double> transform) { 70 return GenerateSteps(start, end, stepWidth).Select(transform) .Where(x => x < end || x.IsAlmost(end));74 return GenerateSteps(start, end, stepWidth).Select(transform); 71 75 } 72 76
Note: See TracChangeset
for help on using the changeset viewer.