Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/12/18 14:54:12 (5 years ago)
Author:
bburlacu
Message:

#2958: Support additional symbols in the SymbolicDataAnalysisExpressionTreeBatchInterpreter

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

Legend:

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

    r16287 r16293  
    6464        a[i] = Math.Cos(b[i]);
    6565    }
     66
     67    public static void Tan(double[] a, double[] b) {
     68      for (int i = 0; i < BATCHSIZE; ++i)
     69        a[i] = Math.Tan(b[i]);
     70    }
     71
     72    public static void Pow(double[] a, double[] b) {
     73      for (int i = 0; i < BATCHSIZE; ++i)
     74        a[i] = Math.Pow(a[i], Math.Round(b[i]));
     75    }
     76
     77    public static void Root(double[] a, double[] b) {
     78      for (int i = 0; i < BATCHSIZE; ++i)
     79        a[i] = Math.Pow(a[i], 1 / Math.Round(b[i]));
     80    }
     81
     82    public static void Square(double[] a, double[] b) {
     83      for (int i = 0; i < BATCHSIZE; ++i)
     84        a[i] = Math.Pow(b[i], 2d);
     85    }
     86
     87    public static void Sqrt(double[] a, double[] b) {
     88      for (int i = 0; i < BATCHSIZE; ++i)
     89        a[i] = Math.Sqrt(b[i]);
     90    }
    6691  }
    6792}
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs

    r16287 r16293  
    6565              break;
    6666            }
     67
    6768          case OpCodes.Add: {
    6869              Load(instr.buf, code[c].buf);
     
    7677              if (n == 1) {
    7778                Neg(instr.buf, code[c].buf);
    78                 break;
    7979              } else {
    8080                Load(instr.buf, code[c].buf);
     
    8282                  Sub(instr.buf, code[c + j].buf);
    8383                }
    84                 break;
    85               }
     84              }
     85              break;
    8686            }
    8787
     
    9797              if (n == 1) {
    9898                Inv(instr.buf, code[c].buf);
    99                 break;
    10099              } else {
    101100                Load(instr.buf, code[c].buf);
     
    103102                  Div(instr.buf, code[c + j].buf);
    104103                }
    105                 break;
    106               }
     104              }
     105              break;
     106            }
     107
     108          case OpCodes.Square: {
     109              Square(instr.buf, code[c].buf);
     110              break;
     111            }
     112
     113          case OpCodes.Root: {
     114              Root(instr.buf, code[c].buf);
     115              break;
     116            }
     117
     118          case OpCodes.SquareRoot: {
     119              Sqrt(instr.buf, code[c].buf);
     120              break;
     121            }
     122
     123          case OpCodes.Power: {
     124              Pow(instr.buf, code[c].buf);
     125              break;
    107126            }
    108127
     
    114133          case OpCodes.Log: {
    115134              Log(instr.buf, code[c].buf);
     135              break;
     136            }
     137
     138          case OpCodes.Sin: {
     139              Sin(instr.buf, code[c].buf);
     140              break;
     141            }
     142
     143          case OpCodes.Cos: {
     144              Cos(instr.buf, code[c].buf);
     145              break;
     146            }
     147
     148          case OpCodes.Tan: {
     149              Tan(instr.buf, code[c].buf);
    116150              break;
    117151            }
     
    139173
    140174      return result;
     175    }
     176
     177    public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
     178      return GetValues(tree, dataset, rows);
    141179    }
    142180
Note: See TracChangeset for help on using the changeset viewer.