Changeset 12612 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/LinearTransformation.cs
- Timestamp:
- 07/06/15 15:58:16 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/LinearTransformation.cs
r12012 r12612 31 31 32 32 namespace HeuristicLab.Problems.DataAnalysis { 33 [StorableClass] 33 34 [Item("Linear Transformation", "f(x) = k * x + d | Represents a linear transformation with multiplication and addition.")] 34 35 public class LinearTransformation : Transformation<double> { … … 80 81 81 82 public override IEnumerable<double> Apply(IEnumerable<double> data) { 82 return data.Select(e => e * Multiplier + Addend); 83 var m = Multiplier; 84 var a = Addend; 85 return data.Select(e => e * m + a); 83 86 } 84 87 85 88 public override bool Check(IEnumerable<double> data, out string errorMsg) { 86 89 errorMsg = null; 87 if (Multiplier == 0.0) {90 if (Multiplier.IsAlmost(0.0)) { 88 91 errorMsg = String.Format("Multiplicand is 0, all {0} entries will be set to {1}. Inverse apply will not be possible (division by 0).", data.Count(), Addend); 89 92 return false;
Note: See TracChangeset
for help on using the changeset viewer.