Changeset 12227
 Timestamp:
 03/19/15 14:54:32 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs
r12012 r12227 299 299 // simplify expressions x0..xn 300 300 // make multiplication (x0 * 1/(x1 * x1 * .. * xn)) 301 var simplifiedTrees = original.Subtrees.Select( x => GetSimplifiedTree(x));301 var simplifiedTrees = original.Subtrees.Select(GetSimplifiedTree).ToArray(); 302 302 return 303 MakeProduct(simplifiedTrees.First(), Invert(simplifiedTrees.Skip(1).Aggregate( (a, b) => MakeProduct(a, b))));303 MakeProduct(simplifiedTrees.First(), Invert(simplifiedTrees.Skip(1).Aggregate(MakeProduct))); 304 304 } 305 305 } … … 310 310 } else { 311 311 return original.Subtrees 312 .Select( x => GetSimplifiedTree(x))313 .Aggregate( (a, b) => MakeProduct(a, b));312 .Select(GetSimplifiedTree).ToArray() 313 .Aggregate(MakeProduct); 314 314 } 315 315 } … … 321 321 // simplify expressions x0..xn 322 322 // make addition (x0,x1..xn) 323 var simplifiedTrees = original.Subtrees.Select( x => GetSimplifiedTree(x));323 var simplifiedTrees = original.Subtrees.Select(GetSimplifiedTree).ToArray(); 324 324 return simplifiedTrees.Take(1) 325 .Concat(simplifiedTrees.Skip(1).Select( x => Negate(x)))326 .Aggregate( (a, b) => MakeSum(a, b));325 .Concat(simplifiedTrees.Skip(1).Select(Negate)) 326 .Aggregate(MakeSum); 327 327 } 328 328 } … … 335 335 // make addition (x0..xn) 336 336 return original.Subtrees 337 .Select( x => GetSimplifiedTree(x))338 .Aggregate( (a, b) => MakeSum(a, b));337 .Select(GetSimplifiedTree).ToArray() 338 .Aggregate(MakeSum); 339 339 } 340 340 }
Note: See TracChangeset
for help on using the changeset viewer.