Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/07/18 15:31:53 (5 years ago)
Author:
gkronber
Message:

#2915: added cube, cbrt, absolute, aq to batched interpreter (and fixed a bug in power)

Location:
branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs

    r16304 r16345  
    8989        a[i] = Math.Sqrt(b[i]);
    9090    }
     91
     92    public static void Cube(double[] a, double[] b) {
     93      for (int i = 0; i < BATCHSIZE; ++i)
     94        a[i] = Math.Pow(b[i], 3d);
     95    }
     96
     97    public static void CubeRoot(double[] a, double[] b) {
     98      for (int i = 0; i < BATCHSIZE; ++i)
     99        a[i] = Math.Pow(b[i], 1d / 3d);
     100    }
     101
     102    public static void Absolute(double[] a, double[] b) {
     103      for (int i = 0; i < BATCHSIZE; ++i)
     104        a[i] = Math.Abs(a[i]);
     105    }
     106
     107    public static void AnalyticQuotient(double[] a, double[] b) {
     108      for (int i = 0; i < BATCHSIZE; ++i)
     109        a[i] = a[i] / Math.Sqrt(1d + b[i] * b[i]);
     110    }
    91111  }
    92112}
  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs

    r16304 r16345  
    120120            }
    121121
     122          case OpCodes.Cube: {
     123              Cube(instr.buf, code[c].buf);
     124              break;
     125            }
     126          case OpCodes.CubeRoot: {
     127              CubeRoot(instr.buf, code[c].buf);
     128              break;
     129            }
     130
    122131          case OpCodes.Power: {
    123               Pow(instr.buf, code[c].buf);
     132              Load(instr.buf, code[c].buf);
     133              Pow(instr.buf, code[c + 1].buf);
    124134              break;
    125135            }
     
    147157          case OpCodes.Tan: {
    148158              Tan(instr.buf, code[c].buf);
     159              break;
     160            }
     161          case OpCodes.Absolute: {
     162              Absolute(instr.buf, code[c].buf);
     163              break;
     164            }
     165          case OpCodes.AnalyticalQuotient: {
     166              Load(instr.buf, code[c].buf);
     167              AnalyticQuotient(instr.buf, code[c].buf);
    149168              break;
    150169            }
Note: See TracChangeset for help on using the changeset viewer.