Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/13/21 10:25:35 (2 years ago)
Author:
gkronber
Message:

#3140: made several more changes while reviewing the branch.

Location:
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchInstruction.cs

    r16285 r18114  
    55    public int childIndex;
    66
    7     public double value; // for constants
     7    public double value; // for numbers and constants
    88    public double weight; // for variables
    99    public double[] buf;
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalArithBoundsEstimator.cs

    r18112 r18114  
    126126            break;
    127127          }
    128         case OpCodes.Constant: {
    129             var constTreeNode = (ConstantTreeNode)currentInstr.dynamicNode;
    130             result = new Interval(constTreeNode.Value, constTreeNode.Value);
    131             break;
    132           }
     128        case OpCodes.Constant: // fall through
    133129        case OpCodes.Number: {
    134             var numberTreeNode = (NumberTreeNode)currentInstr.dynamicNode;
    135             result = new Interval(numberTreeNode.Value, numberTreeNode.Value);
     130            var numericTreeNode = (INumericTreeNode)currentInstr.dynamicNode;
     131            result = new Interval(numericTreeNode.Value, numericTreeNode.Value);
    136132            break;
    137133          }
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalArithCompiledExpressionBoundsEstimator.cs

    r18112 r18114  
    154154            );
    155155          }
    156         case OpCodes.Constant: {
    157             var v = (node as NumberTreeNode).Value;
    158             // we have to make an interval out of the constant because this may be the root of the tree (and we are expected to return an Interval)
    159             return Expression.Constant(new Interval(v, v), typeof(Interval));
    160           }
     156        case OpCodes.Constant: // fall through
    161157        case OpCodes.Number: {
    162             var v = (node as NumberTreeNode).Value;
    163             // we have to make an interval out of the constant because this may be the root of the tree (and we are expected to return an Interval)
     158            var v = (node as INumericTreeNode).Value;
     159            // we have to make an interval out of the number because this may be the root of the tree (and we are expected to return an Interval)
    164160            return Expression.Constant(new Interval(v, v), typeof(Interval));
    165161          }
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs

    r18112 r18114  
    186186            break;
    187187          }
    188         case OpCodes.Number: {
    189             var numberTreeNode = (NumberTreeNode)currentInstr.dynamicNode;
    190             result = new Interval(numberTreeNode.Value, numberTreeNode.Value);
    191             break;
    192           }
     188        case OpCodes.Number: // fall through
    193189        case OpCodes.Constant: {
    194           var constTreeNode = (ConstantTreeNode)currentInstr.dynamicNode;
    195           result = new Interval(constTreeNode.Value, constTreeNode.Value);
     190          var numericTreeNode = (INumericTreeNode)currentInstr.dynamicNode;
     191          result = new Interval(numericTreeNode.Value, numericTreeNode.Value);
    196192          break;
    197193          }
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs

    r18112 r18114  
    157157      #region switch opcode
    158158      switch (opcode) {
    159         case OpCodes.Constant: {
    160             var constantTreeNode = (ConstantTreeNode)node;
    161             return Expression.Constant(constantTreeNode.Value);
    162           }
     159        case OpCodes.Constant: // fall through
    163160        case OpCodes.Number: {
    164           var numberTreeNode = (NumberTreeNode)node;
     161          var numberTreeNode = (INumericTreeNode)node;
    165162          return Expression.Constant(numberTreeNode.Value);
    166163          }
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r18112 r18114  
    711711            return;
    712712          }
    713         case OpCodes.Number: {
    714             NumberTreeNode numberNode = (NumberTreeNode)currentInstr.dynamicNode;
    715             il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, numberNode.Value);
    716             return;
    717           }
     713        case OpCodes.Number: // fall through
    718714        case OpCodes.Constant: {
    719           ConstantTreeNode constNode = (ConstantTreeNode) currentInstr.dynamicNode;
     715          var constNode = (INumericTreeNode) currentInstr.dynamicNode;
    720716          il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, constNode.Value);
    721717          return;
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r18112 r18114  
    496496            return ((IList<double>)currentInstr.data)[actualRow] * laggedVariableTreeNode.Weight;
    497497          }
    498         case OpCodes.Constant: {
    499             var constTreeNode = (ConstantTreeNode)currentInstr.dynamicNode;
    500             return constTreeNode.Value;
    501           }
     498        case OpCodes.Constant:  // fall through
    502499        case OpCodes.Number: {
    503           var numberTreeNode = (NumberTreeNode) currentInstr.dynamicNode;
    504           return numberTreeNode.Value;
     500          var numericTreeNode = (INumericTreeNode) currentInstr.dynamicNode;
     501          return numericTreeNode.Value;
    505502        }
    506503
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r18112 r18114  
    416416        #region opcode switch
    417417        switch (instr.opCode) {
    418           case OpCodes.Number: {
    419               var numberTreeNode = (NumberTreeNode)instr.dynamicNode;
    420               instr.value = numberTreeNode.Value;
    421               instr.skip = true; // the value is already set so this instruction should be skipped in the evaluation phase
    422             }
    423             break;
     418          case OpCodes.Number: // fall through
    424419          case OpCodes.Constant: {
    425             var constTreeNode = (ConstantTreeNode)instr.dynamicNode;
    426             instr.value = constTreeNode.Value;
     420            var numericTreeNode = (INumericTreeNode)instr.dynamicNode;
     421            instr.value = numericTreeNode.Value;
    427422            instr.skip = true; // the value is already set so this instruction should be skipped in the evaluation phase
    428423            }
Note: See TracChangeset for help on using the changeset viewer.