Commit 13fe9a31 authored by Anastasiia's avatar Anastasiia

speed up remainder computation without using parallel collections

parent 21e96b41
......@@ -677,7 +677,6 @@ trait Taylor{
// val simple = simplify(e)
deltasOf(e).foreach(wrt => {
val tmp = getPartialDerivative(e, wrt.id) //recurseDerivative(e, wrt.id)
//todo leave simple simplifications
taylorSeries = taylorSeries :+ (easySimplify(tmp), wrt.id)
})
taylorSeries
......@@ -697,11 +696,14 @@ trait Taylor{
// both deltas and epsilons
val deltas:Set[Expr with Identifiable] = deltasOf(simple) ++ epsilonsOf(simple)
//todo fix fold or map
val firstTerm = deltas.par.map(wrt => {
reporter.warning("Amount of runs for the first remainder term "+ Math.pow(deltas.size, 2)*intervals.size)
val firstTerm = deltas.map(wrt => {
// first derivative
val tmp = easySimplify(
getPartialDerivative(simple, wrt.getId))
val tmpValOut = deltas.par.map(wrtIn => {
val tmpValOut = deltas.map(wrtIn => {
val start = System.currentTimeMillis()
// second derivative
if (containsVariables(tmp, wrtIn.getId)) {
val tmpIn = Times(wrt, Times(wrtIn, moreSimplify(
......@@ -720,6 +722,7 @@ trait Taylor{
None
}
})
reporter.warning(s"finished iteration for $wrt, $wrtIn; time:" + (System.currentTimeMillis() - start))
tmpVal.max(optionAbsOrdering)
}
else None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment