Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/10 13:51:23 (14 years ago)
Author:
mkommend
Message:

Corrected SymbolicSimplifier negate method (ticket #1340).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SymbolicSimplifier.cs

    r4477 r5108  
    482482      } else if (IsAddition(x)) {
    483483        // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn)       
    484         foreach (var subTree in x.SubTrees) {
    485           Negate(subTree);
    486         }
     484        for (int i = 0; i < x.SubTrees.Count; i++)
     485          x.SubTrees[i] = Negate(x.SubTrees[i]);
    487486      } else if (IsMultiplication(x) || IsDivision(x)) {
    488487        // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn
    489         Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant
     488        x.SubTrees[x.SubTrees.Count - 1] = Negate(x.SubTrees.Last()); // last is maybe a constant, prefer to negate the constant
    490489      } else {
    491490        // any other function
Note: See TracChangeset for help on using the changeset viewer.