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/AlgebraicSparseVector.cs

    r17298 r17303  
    109109    }
    110110
    111     public AlgebraicSparseVector<K, T> AssignMin(AlgebraicSparseVector<K, T> other) {
    112       // assumes that keys without a matching key in other are zero and vice versa
    113       foreach (var kvp in elems) if (!other.elems.ContainsKey(kvp.Key)) kvp.Value.AssignMin(kvp.Value.Zero); // min(v, 0)
    114       foreach (var kvp in other.elems) {
    115         if (elems.TryGetValue(kvp.Key, out T value))
    116           value.AssignMin(kvp.Value);
    117         else
    118           elems.Add(kvp.Key, kvp.Value.Zero.AssignMin(kvp.Value));
    119       }
    120       return this;
    121     }
    122 
    123     public AlgebraicSparseVector<K, T> AssignMax(AlgebraicSparseVector<K, T> other) {
    124       // assumes that keys without a matching key in other are zero and vice versa
    125       foreach (var kvp in elems) if (!other.elems.ContainsKey(kvp.Key)) kvp.Value.AssignMax(kvp.Value.Zero); // max(v, 0)
    126       foreach (var kvp in other.elems) {
    127         if (elems.TryGetValue(kvp.Key, out T value))
    128           value.AssignMax(kvp.Value);
    129         else
    130           elems.Add(kvp.Key, kvp.Value.Zero.AssignMax(kvp.Value));
    131       }
    132       return this;
    133     }
    134 
    135 
    136111    public AlgebraicSparseVector<K, T> Clone() {
    137112      return new AlgebraicSparseVector<K, T>(this);
Note: See TracChangeset for help on using the changeset viewer.