Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/08/19 08:53:54 (6 years ago)
Author:
gkronber
Message:

#2866: added support for tanh to the remaining interpreters (native is missing)

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs

    r16565 r16668  
    4545    private static readonly MethodInfo Cos = typeof(Math).GetMethod("Cos", new[] { typeof(double) });
    4646    private static readonly MethodInfo Tan = typeof(Math).GetMethod("Tan", new[] { typeof(double) });
     47    private static readonly MethodInfo Tanh = typeof(Math).GetMethod("Tanh", new[] { typeof(double) });
    4748    private static readonly MethodInfo Sqrt = typeof(Math).GetMethod("Sqrt", new[] { typeof(double) });
    4849    private static readonly MethodInfo Floor = typeof(Math).GetMethod("Floor", new[] { typeof(double) });
     
    223224            return Expression.Call(Tan, arg);
    224225          }
     226        case OpCodes.Tanh: {
     227            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
     228            return Expression.Call(Tanh, arg);
     229          }
    225230        case OpCodes.Square: {
    226231            var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r16585 r16668  
    4545    private static MethodInfo sin = typeof(Math).GetMethod("Sin", new Type[] { typeof(double) });
    4646    private static MethodInfo tan = typeof(Math).GetMethod("Tan", new Type[] { typeof(double) });
     47    private static MethodInfo tanh = typeof(Math).GetMethod("Tanh", new Type[] { typeof(double) });
    4748    private static MethodInfo exp = typeof(Math).GetMethod("Exp", new Type[] { typeof(double) });
    4849    private static MethodInfo log = typeof(Math).GetMethod("Log", new Type[] { typeof(double) });
     
    283284            CompileInstructions(il, state, ds);
    284285            il.Emit(System.Reflection.Emit.OpCodes.Call, tan);
     286            return;
     287          }
     288        case OpCodes.Tan: {
     289            CompileInstructions(il, state, ds);
     290            il.Emit(System.Reflection.Emit.OpCodes.Call, tanh);
    285291            return;
    286292          }
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r16656 r16668  
    217217            return Math.Tan(Evaluate(dataset, ref row, state));
    218218          }
     219        case OpCodes.Tanh: {
     220            return Math.Tanh(Evaluate(dataset, ref row, state));
     221          }
    219222        case OpCodes.Square: {
    220223            return Math.Pow(Evaluate(dataset, ref row, state), 2);
Note: See TracChangeset for help on using the changeset viewer.