iterationMap method
Returns a map containing the number of inner iterations for each outer iteration step.
Implementation
Future<Map<int, int>> iterationMap({
bool isRecursive = false,
num ratio = 0.5,
}) async {
/// Initialize parameters:
final temperatures = await this.temperatures;
final result = <int, int>{};
int nInner(num t) => markovChainLength(t,
tStart: temperatures.first,
tEnd: temperatures.last,
chainLengthStart: innerIterationsStart,
chainLengthEnd: innerIterationsEnd);
if (_recursionCounter == 0) {
_t = temperatures.first;
}
// During the first iteration pow(ratio.abs(), _recursionCounter) = 1.0
// and therefore i = 0.
var i = (temperatures.length * (1.0 - pow(ratio.abs(), _recursionCounter)))
.toInt();
++_recursionCounter;
// Outer iteration loop.
for (i; i < temperatures.length; i++) {
_t = temperatures[i];
// Store the number of iterations at constant temperature.
result[i] = nInner(_t);
}
return result;
}