Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/13/11 17:38:29 (13 years ago)
Author:
gkronber
Message:

#1480 implemented code to handle root symbols for the il emitting interpreter and fixed code for power symbol.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r6741 r6755  
    4444    private static MethodInfo log = typeof(Math).GetMethod("Log", new Type[] { typeof(double) });
    4545    private static MethodInfo power = typeof(Math).GetMethod("Pow", new Type[] { typeof(double), typeof(double) });
     46    private static MethodInfo round = typeof(Math).GetMethod("Round", new Type[] { typeof(double) });
    4647
    4748    internal delegate double CompiledFunction(int sampleIndex, IList<double>[] columns);
     
    340341            CompileInstructions(il, state);
    341342            CompileInstructions(il, state);
     343            il.Emit(System.Reflection.Emit.OpCodes.Call, round);
    342344            il.Emit(System.Reflection.Emit.OpCodes.Call, power);
    343345            return;
    344346          }
    345347        case OpCodes.Root: {
    346             throw new NotImplementedException();
     348            CompileInstructions(il, state);
     349            il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0); // 1 / round(...)
     350            CompileInstructions(il, state);
     351            il.Emit(System.Reflection.Emit.OpCodes.Call, round);
     352            il.Emit(System.Reflection.Emit.OpCodes.Div);
     353            il.Emit(System.Reflection.Emit.OpCodes.Call, power);
     354            return;
    347355          }
    348356        case OpCodes.Exp: {
Note: See TracChangeset for help on using the changeset viewer.