Commit eae0afdb authored by Anastasiia's avatar Anastasiia

remainder computaitons

parent dead913a
......@@ -698,31 +698,36 @@ trait Taylor{
//todo fix fold or map
reporter.warning("Amount of runs for the first remainder term "+ Math.pow(deltas.size, 2)*intervals.size)
val firstTerm = deltas.map(wrt => {
// val wrtSt = System.currentTimeMillis()
// first derivative
val tmp = easySimplify(
getPartialDerivative(simple, wrt.getId))
val tmpValOut = deltas.map(wrtIn => {
val start = System.currentTimeMillis()
val tmpValOut = deltas.par.map(wrtIn => {
// val start = System.currentTimeMillis()
// second derivative
if (containsVariables(tmp, wrtIn.getId)) {
val tmpIn = Times(wrt, Times(wrtIn, moreSimplify(
getPartialDerivative(tmp, wrtIn.getId))))
val tmpIn = easySimplify(Times(wrt, Times(wrtIn, moreSimplify(
getPartialDerivative(tmp, wrtIn.getId)))))
// reporter.warning(s"=============WRT $wrt * $wrtIn===============")
// reporter.warning(s"Second derivative $tmpIn")
val tmpVal = intervals.par.map(x => {
val interval = evaluateInterval(tmpIn, x)
if (interval.isDefined)
Some(maxAbs(interval.get))
else {
if (!listFailed.contains(x)) {
listFailed = listFailed :+ x
}
None
val tmpVal = tmpIn match {
case x @ Delta(id) => Seq(Some(maxAbs(x.interval)))
case x @ Epsilon(id) => Seq(Some(maxAbs(x.interval)))
case _ =>
intervals.par.map(x => {
val interval = evaluateInterval (tmpIn, x)
if (interval.isDefined)
Some (maxAbs (interval.get) )
else {
if (! listFailed.contains (x) ) {
listFailed = listFailed :+ x
}
None
}
})
}
})
reporter.warning(s"finished iteration for $wrt, $wrtIn; time:" + (System.currentTimeMillis() - start))
// reporter.warning(s"finished iteration for $wrt, $wrtIn; time:" + (System.currentTimeMillis() - start))
tmpVal.max(optionAbsOrdering)
}
else None
......@@ -731,6 +736,7 @@ trait Taylor{
reporter.debug(s"before "+ listFailed.map(removeDeltasFromMap))
listFailed = listFailed.filter(x => removeDeltasFromMap(x).keySet == removeDeltasFromMap(intervals.head).keySet)
reporter.debug(s"after "+ listFailed.map(removeDeltasFromMap))
// reporter.warning(s"done for $wrt in " + (System.currentTimeMillis()-wrtSt))
tmpValOut.fold(None)(sumOption)
})
......
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