Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/03/12 00:32:03 (12 years ago)
Author:
gkronber
Message:

#1810 merged patch to add square and square root function symbols by mkommend

File:
1 edited

Legend:

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

    r7506 r7695  
    133133
    134134      public const byte VariableCondition = 27;
     135
     136      public const byte Square = 28;
     137      public const byte SquareRoot = 29;
    135138    }
    136139    #endregion
     
    154157      { typeof(Average), OpCodes.Average},
    155158      { typeof(InvokeFunction), OpCodes.Call },
    156       { typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Variable), OpCodes.Variable },
     159      { typeof(Variable), OpCodes.Variable },
    157160      { typeof(LaggedVariable), OpCodes.LagVariable },
    158161      { typeof(Constant), OpCodes.Constant },
     
    163166      { typeof(Integral), OpCodes.Integral},
    164167      { typeof(Derivative), OpCodes.Derivative},
    165       { typeof(VariableCondition),OpCodes.VariableCondition}
     168      { typeof(VariableCondition),OpCodes.VariableCondition},
     169      { typeof(Square),OpCodes.Square},
     170      {typeof(SquareRoot),OpCodes.SquareRoot}
    166171    };
    167172
     
    305310            return Math.Tan(Evaluate(dataset, ref row, state));
    306311          }
     312        case OpCodes.Square: {
     313            return Math.Pow(Evaluate(dataset, ref row, state), 2);
     314          }
    307315        case OpCodes.Power: {
    308316            double x = Evaluate(dataset, ref row, state);
    309317            double y = Math.Round(Evaluate(dataset, ref row, state));
    310318            return Math.Pow(x, y);
     319          }
     320        case OpCodes.SquareRoot: {
     321            return Math.Sqrt(Evaluate(dataset, ref row, state));
    311322          }
    312323        case OpCodes.Root: {
Note: See TracChangeset for help on using the changeset viewer.