Ignore:
Timestamp:
10/03/19 12:30:19 (3 years ago)
Author:
gkronber
Message:

#2994 continued refactoring and extended unit tests. Interval calculation still fails for some edge cases (mainly for undefined behaviour). VectorEvaluator and VectorAutoDiffEvaluator produce the same results as the LinearInterpreter. TODO: check gradient calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/AlgebraicDouble.cs

    r17298 r17303  
    55  // algebraic type wrapper for a double value
    66  [DebuggerDisplay("{Value}")]
    7   public sealed class AlgebraicDouble : IAlgebraicType<AlgebraicDouble> {
     7  public sealed class AlgebraicDouble : IComparableAlgebraicType<AlgebraicDouble> {
    88    public static implicit operator AlgebraicDouble(double value) { return new AlgebraicDouble(value); }
    99    public static implicit operator double(AlgebraicDouble value) { return value.Value; }
     
    3535    public AlgebraicDouble AssignIntPower(AlgebraicDouble a, int p) { Value = Math.Pow(a.Value, p); return this; }
    3636    public AlgebraicDouble AssignIntRoot(AlgebraicDouble a, int r) { Value = IntRoot(a.Value, r); return this; }
    37     public AlgebraicDouble AssignMin(AlgebraicDouble other) { Value = Math.Min(Value, other.Value); return this; }
    38     public AlgebraicDouble AssignMax(AlgebraicDouble other) { Value = Math.Max(Value, other.Value); return this; }
     37    //public AlgebraicDouble AssignMin(AlgebraicDouble other) { Value = Math.Min(Value, other.Value); return this; }
     38    //public AlgebraicDouble AssignMax(AlgebraicDouble other) { Value = Math.Max(Value, other.Value); return this; }
    3939    public AlgebraicDouble AssignAbs(AlgebraicDouble a) { Value = Math.Abs(a.Value); return this; }
    4040    public AlgebraicDouble AssignSgn(AlgebraicDouble a) { Value = double.IsNaN(a.Value) ? double.NaN : Math.Sign(a.Value); return this; }
     
    5151      return Value.ToString();
    5252    }
     53
     54    public int CompareTo(AlgebraicDouble other) {
     55      return Value.CompareTo(other.Value);
     56    }
    5357  }
    5458}
Note: See TracChangeset for help on using the changeset viewer.