Changeset 16676 for branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
- Timestamp:
- 03/13/19 09:30:18 (5 years ago)
- Location:
- branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r16360 r16676 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 31 31 using HeuristicLab.Parameters; 32 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;32 using HEAL.Attic; 33 33 34 34 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 35 [Storable Class]35 [StorableType("426718E3-2A57-4CA4-98A1-65EDD0B0BDBF")] 36 36 [Item("SymbolicDataAnalysisExpressionTreeILEmittingInterpreter", "Interpreter for symbolic expression trees.")] 37 37 public sealed class SymbolicDataAnalysisExpressionTreeILEmittingInterpreter : ParameterizedNamedItem, ISymbolicDataAnalysisExpressionTreeInterpreter { … … 45 45 private static MethodInfo sin = typeof(Math).GetMethod("Sin", new Type[] { typeof(double) }); 46 46 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) }); 47 48 private static MethodInfo exp = typeof(Math).GetMethod("Exp", new Type[] { typeof(double) }); 48 49 private static MethodInfo log = typeof(Math).GetMethod("Log", new Type[] { typeof(double) }); … … 104 105 105 106 [StorableConstructor] 106 private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter( bool deserializing) : base(deserializing) { }107 private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(StorableConstructorFlag _) : base(_) { } 107 108 108 109 private SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(SymbolicDataAnalysisExpressionTreeILEmittingInterpreter original, Cloner cloner) : base(original, cloner) { } … … 285 286 return; 286 287 } 288 case OpCodes.Tanh: { 289 CompileInstructions(il, state, ds); 290 il.Emit(System.Reflection.Emit.OpCodes.Call, tanh); 291 return; 292 } 287 293 case OpCodes.Power: { 288 294 CompileInstructions(il, state, ds); … … 425 431 Label c1 = il.DefineLabel(); 426 432 CompileInstructions(il, state, ds); 427 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // > 0433 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0 428 434 il.Emit(System.Reflection.Emit.OpCodes.Cgt); 429 435 il.Emit(System.Reflection.Emit.OpCodes.Brfalse, c1); … … 440 446 CompileInstructions(il, state, ds); 441 447 for (int i = 1; i < nArgs; i++) { 442 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // > 0448 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0 443 449 il.Emit(System.Reflection.Emit.OpCodes.Cgt); 444 450 il.Emit(System.Reflection.Emit.OpCodes.Brfalse, falseBranch); 445 451 CompileInstructions(il, state, ds); 446 452 } 447 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // > 0453 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0 448 454 il.Emit(System.Reflection.Emit.OpCodes.Cgt); 449 455 il.Emit(System.Reflection.Emit.OpCodes.Brfalse, falseBranch); … … 465 471 // complex definition because of special properties of NaN 466 472 il.Emit(System.Reflection.Emit.OpCodes.Dup); 467 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // <= 0473 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // <= 0 468 474 il.Emit(System.Reflection.Emit.OpCodes.Ble, nextArgBranch); 469 475 il.Emit(System.Reflection.Emit.OpCodes.Br, resultBranch); … … 473 479 } 474 480 il.MarkLabel(resultBranch); 475 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // > 0481 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0 476 482 il.Emit(System.Reflection.Emit.OpCodes.Cgt); 477 483 il.Emit(System.Reflection.Emit.OpCodes.Brtrue, trueBranch); … … 486 492 case OpCodes.NOT: { 487 493 CompileInstructions(il, state, ds); 488 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0); // > 0494 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); // > 0 489 495 il.Emit(System.Reflection.Emit.OpCodes.Cgt); 490 496 il.Emit(System.Reflection.Emit.OpCodes.Conv_R8); // convert to float64 … … 498 504 case OpCodes.XOR: { 499 505 CompileInstructions(il, state, ds); 500 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0);506 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); 501 507 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0 502 508 503 509 for (int i = 1; i < nArgs; i++) { 504 510 CompileInstructions(il, state, ds); 505 il.Emit(System.Reflection.Emit.OpCodes.Ldc_ I4_0);511 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); 506 512 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0 507 513 il.Emit(System.Reflection.Emit.OpCodes.Xor);
Note: See TracChangeset
for help on using the changeset viewer.