Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/14/19 16:41:37 (5 years ago)
Author:
msemenki
Message:

#2866: Add support of new symbol to the BatchedInterpreter and TreeToAutoDiffTermConverter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2866_SymRegHyperbolicFunctions/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r16360 r16531  
    7676      eval: Math.Tan,
    7777      diff: x => 1 + Math.Tan(x) * Math.Tan(x));
    78 
     78    private static readonly Func<Term, UnaryFunc> tanh = UnaryFunc.Factory(
     79      eval: Math.Tanh,
     80      diff: x => 1 - Math.Tanh(x) * Math.Tanh(x));
    7981    private static readonly Func<Term, UnaryFunc> erf = UnaryFunc.Factory(
    8082      eval: alglib.errorfunction,
     
    261263      if (node.Symbol is Tangent) {
    262264        return tan(
     265          ConvertToAutoDiff(node.GetSubtree(0)));
     266      }
     267      if (node.Symbol is HyperbolicTangent) {
     268        return tanh(
    263269          ConvertToAutoDiff(node.GetSubtree(0)));
    264270      }
     
    321327          !(n.Symbol is Cosine) &&
    322328          !(n.Symbol is Tangent) &&
     329          !(n.Symbol is HyperbolicTangent) &&
    323330          !(n.Symbol is Erf) &&
    324331          !(n.Symbol is Norm) &&
Note: See TracChangeset for help on using the changeset viewer.