Changeset 16911 for branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
- Timestamp:
- 05/07/19 15:38:16 (6 years ago)
- Location:
- branches/2994-AutoDiffForIntervals
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2994-AutoDiffForIntervals
- Property svn:mergeinfo changed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 16839,16858,16868,16905
- Property svn:mergeinfo changed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs
r16656 r16911 101 101 public static void CubeRoot(double[] a, double[] b) { 102 102 for (int i = 0; i < BATCHSIZE; ++i) 103 a[i] = Math.Pow(b[i], 1d / 3d);103 a[i] = b[i] < 0 ? -Math.Pow(-b[i], 1d / 3d) : Math.Pow(b[i], 1d / 3d); 104 104 } 105 105 -
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs
r16668 r16911 247 247 case OpCodes.CubeRoot: { 248 248 var arg = MakeExpr(node.GetSubtree(0), variableIndices, row, columns); 249 return Expression.Power(arg, Expression.Constant(1.0 / 3.0)); 249 return Expression.Condition(Expression.LessThan(arg, Expression.Constant(0.0)), 250 Expression.Negate(Expression.Power(Expression.Negate(arg), Expression.Constant(1.0 / 3.0))), 251 Expression.Power(arg, Expression.Constant(1.0 / 3.0))); 250 252 } 251 253 case OpCodes.Root: { … … 514 516 var x1 = MakeExpr(node.GetSubtree(0), variableIndices, row, columns); 515 517 var x2 = MakeExpr(node.GetSubtree(1), variableIndices, row, columns); 516 return Expression.Divide(x1, 517 Expression.Call(Sqrt, 518 return Expression.Divide(x1, 519 Expression.Call(Sqrt, 518 520 Expression.Add( 519 521 Expression.Constant(1.0), -
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r16670 r16911 336 336 case OpCodes.CubeRoot: { 337 337 CompileInstructions(il, state, ds); 338 var c1 = il.DefineLabel(); 339 var end = il.DefineLabel(); 340 341 il.Emit(System.Reflection.Emit.OpCodes.Dup); // x 342 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 0.0); 343 il.Emit(System.Reflection.Emit.OpCodes.Clt); // x < 0? 344 il.Emit(System.Reflection.Emit.OpCodes.Brfalse, c1); 345 il.Emit(System.Reflection.Emit.OpCodes.Neg); // x = -x 338 346 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0 / 3.0); 339 347 il.Emit(System.Reflection.Emit.OpCodes.Call, power); 348 il.Emit(System.Reflection.Emit.OpCodes.Neg); // -Math.Pow(-x, 1/3) 349 il.Emit(System.Reflection.Emit.OpCodes.Br, end); 350 il.MarkLabel(c1); 351 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0 / 3.0); 352 il.Emit(System.Reflection.Emit.OpCodes.Call, power); 353 il.MarkLabel(end); 340 354 return; 341 355 } -
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r16670 r16911 232 232 } 233 233 case OpCodes.CubeRoot: { 234 return Math.Pow(Evaluate(dataset, ref row, state), 1.0 / 3.0); 234 var arg = Evaluate(dataset, ref row, state); 235 return arg < 0 ? -Math.Pow(-arg, 1.0 / 3.0) : Math.Pow(arg, 1.0 / 3.0); 235 236 } 236 237 case OpCodes.Root: { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r16656 r16911 245 245 instr.value = Math.Sqrt(code[instr.childIndex].value); 246 246 } else if (instr.opCode == OpCodes.CubeRoot) { 247 instr.value = Math.Pow(code[instr.childIndex].value, 1.0 / 3.0); 247 var arg = code[instr.childIndex].value; 248 instr.value = arg < 0 ? -Math.Pow(-arg, 1.0 / 3.0) : Math.Pow(arg, 1.0 / 3.0); 248 249 } else if (instr.opCode == OpCodes.Root) { 249 250 double x = code[instr.childIndex].value;
Note: See TracChangeset
for help on using the changeset viewer.