Changeset 155 for trunk/sources/HeuristicLab.Functions/Signum.cs
- Timestamp:
- 04/22/08 18:05:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Functions/Signum.cs
r2 r155 31 31 public class Signum : FunctionBase { 32 32 public override string Description { 33 get { return "Returns the signum of the first sub- operator."; }33 get { return "Returns the signum of the first sub-tree."; } 34 34 } 35 35 … … 40 40 } 41 41 42 public Signum(Signum source, IDictionary<Guid, object> clonedObjects) 43 : base(source, clonedObjects) { 44 } 45 46 47 public override double Evaluate(Dataset dataset, int sampleIndex) { 48 double value = SubFunctions[0].Evaluate(dataset, sampleIndex); 42 public override double Apply(Dataset dataset, int sampleIndex, double[] args) { 43 double value = args[0]; 49 44 if(value < 0) return -1; 50 45 if(value > 0) return 1; 51 46 return 0; 52 47 } 53 54 public override object Clone(IDictionary<Guid, object> clonedObjects) {55 Signum clone = new Signum(this, clonedObjects);56 clonedObjects.Add(clone.Guid, clone);57 return clone;58 }59 60 48 61 49 public override void Accept(IFunctionVisitor visitor) {
Note: See TracChangeset
for help on using the changeset viewer.