Fix for spacing

This commit is contained in:
Dennis Eichhorn 2017-10-27 18:17:06 +02:00
parent ba1b82f559
commit 77e662bd0b
7 changed files with 31 additions and 31 deletions

View File

@ -122,7 +122,7 @@ class ExponentialSmoothing
} }
$sum = 0; $sum = 0;
for($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$sum += pow($damping, $i); $sum += pow($damping, $i);
} }
@ -140,7 +140,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1]; $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1];
$tempForecast[$i] = $level[$i]; $tempForecast[$i] = $level[$i];
@ -172,7 +172,7 @@ class ExponentialSmoothing
$forecast = []; $forecast = [];
$seasonal = []; $seasonal = [];
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i-1] - $level[0]; $seasonal[$i] = $this->data[$i-1] - $level[0];
} }
@ -185,7 +185,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1]; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1];
@ -223,7 +223,7 @@ class ExponentialSmoothing
$forecast = []; $forecast = [];
$seasonal = []; $seasonal = [];
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i] / $level[0]; $seasonal[$i] = $this->data[$i] / $level[0];
} }
@ -236,7 +236,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1]; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1];
@ -282,7 +282,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]);
$trend[$i] = $beta * ($level[$i] - $level[$i-1]) + (1 - $beta) * $damping * $trend[$i-1]; $trend[$i] = $beta * ($level[$i] - $level[$i-1]) + (1 - $beta) * $damping * $trend[$i-1];
@ -320,13 +320,13 @@ class ExponentialSmoothing
$seasonal = []; $seasonal = [];
$sum = 0; $sum = 0;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle;
} }
$trend[0] *= $sum; $trend[0] *= $sum;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i-1] - $level[0]; $seasonal[$i] = $this->data[$i-1] - $level[0];
} }
@ -342,7 +342,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]);
@ -387,13 +387,13 @@ class ExponentialSmoothing
$gamma_ = $gamma * (1 - $alpha); $gamma_ = $gamma * (1 - $alpha);
$sum = 0; $sum = 0;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle;
} }
$trend[0] *= $sum; $trend[0] *= $sum;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i] / $level[0]; $seasonal[$i] = $this->data[$i] / $level[0];
} }
@ -409,7 +409,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]);
@ -459,7 +459,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping);
$trend[$i] = $beta * ($level[$i] / $level[$i-1]) + (1 - $beta) * pow($trend[$i-1], $damping); $trend[$i] = $beta * ($level[$i] / $level[$i-1]) + (1 - $beta) * pow($trend[$i-1], $damping);
@ -496,13 +496,13 @@ class ExponentialSmoothing
$seasonal = []; $seasonal = [];
$sum = 0; $sum = 0;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle;
} }
$trend[0] *= $sum; $trend[0] *= $sum;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i-1] - $level[0]; $seasonal[$i] = $this->data[$i-1] - $level[0];
} }
@ -518,7 +518,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping);
@ -562,13 +562,13 @@ class ExponentialSmoothing
$seasonal = []; $seasonal = [];
$sum = 0; $sum = 0;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle;
} }
$trend[0] *= $sum; $trend[0] *= $sum;
for($i = 1; $i < $cycle+1; $i++) { for ($i = 1; $i < $cycle+1; $i++) {
$seasonal[$i] = $this->data[$i] / $level[0]; $seasonal[$i] = $this->data[$i] / $level[0];
} }
@ -584,7 +584,7 @@ class ExponentialSmoothing
$error = []; $error = [];
$tempForecast = []; $tempForecast = [];
for($i = 1; $i < $dataLength; $i++) { for ($i = 1; $i < $dataLength; $i++) {
$hm = (int) floor(($i-1) % $cycle) + 1; $hm = (int) floor(($i-1) % $cycle) + 1;
$level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping);

View File

@ -44,7 +44,7 @@ class MarketShareEstimation {
public static function getRankFromMarketShare(int $participants, float $marketShare, float $modifier = 1.0) : int public static function getRankFromMarketShare(int $participants, float $marketShare, float $modifier = 1.0) : int
{ {
$sum = 0.0; $sum = 0.0;
for($i = 0; $i < $participants; $i++) { for ($i = 0; $i < $participants; $i++) {
$sum += 1 / pow($i+1, $modifier); $sum += 1 / pow($i+1, $modifier);
} }
@ -67,7 +67,7 @@ class MarketShareEstimation {
public static function getMarketShareFromRank(int $participants, int $rank, float $modifier = 1.0) : float public static function getMarketShareFromRank(int $participants, int $rank, float $modifier = 1.0) : float
{ {
$sum = 0.0; $sum = 0.0;
for($i = 0; $i < $participants; $i++) { for ($i = 0; $i < $participants; $i++) {
$sum += 1 / pow($i+1, $modifier); $sum += 1 / pow($i+1, $modifier);
} }

View File

@ -28,9 +28,9 @@ class CholeskyDecomposition
$this->L = $M->toArray(); $this->L = $M->toArray();
$this->m = $M->getM(); $this->m = $M->getM();
for($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for($j = $i; $j < $this->m; ++$j) { for ($j = $i; $j < $this->m; ++$j) {
for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) { for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
$sum -= $this->L[$i][$k] * $this->L[$j][$k]; $sum -= $this->L[$i][$k] * $this->L[$j][$k];
} }
if ($i == $j) { if ($i == $j) {

View File

@ -574,7 +574,7 @@ class Matrix implements \ArrayAccess, \Iterator
$mDim = count($b); $mDim = count($b);
$matrix = $this->matrix; $matrix = $this->matrix;
for($col = 0; $col < $mDim; $col++) { for ($col = 0; $col < $mDim; $col++) {
$j = $col; $j = $col;
$max = $matrix[$j][$j]; $max = $matrix[$j][$j];

View File

@ -281,20 +281,20 @@ class SmartDateTime extends \DateTime
$daysPreviousMonth = $previousMonth->getDaysOfMonth(); $daysPreviousMonth = $previousMonth->getDaysOfMonth();
// add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first)
for($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) { for ($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) {
$days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i+1)); $days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i+1));
} }
// add normal count of current days // add normal count of current days
$daysMonth = $this->getDaysOfMonth(); $daysMonth = $this->getDaysOfMonth();
for($i = 1; $i <= $daysMonth; $i++) { for ($i = 1; $i <= $daysMonth; $i++) {
$days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i)); $days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i));
} }
// add remaining days to next month (7*6 - difference+count of current month) // add remaining days to next month (7*6 - difference+count of current month)
$remainingDays = 42 - $diffToWeekStart - $daysMonth; $remainingDays = 42 - $diffToWeekStart - $daysMonth;
$nextMonth = $this->createModify(0, 1); $nextMonth = $this->createModify(0, 1);
for($i = 1; $i <= $remainingDays; $i++) { for ($i = 1; $i <= $remainingDays; $i++) {
$days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i));
} }

View File

@ -133,7 +133,7 @@ class Tree extends Graph
{ {
$depth = $this->getMaxDepth(); $depth = $this->getMaxDepth();
for($i = 1; $i < $depth; $i++) { for ($i = 1; $i < $depth; $i++) {
$nodes = $this->getLevel($i); $nodes = $this->getLevel($i);
callback($nodes); callback($nodes);
} }

View File

@ -384,7 +384,7 @@ class StringUtils
$l = mb_strlen($input, 'UTF-8'); $l = mb_strlen($input, 'UTF-8');
$unique = []; $unique = [];
for($i = 0; $i < $l; $i++) { for ($i = 0; $i < $l; $i++) {
$char = mb_substr($input, $i, 1, 'UTF-8'); $char = mb_substr($input, $i, 1, 'UTF-8');
if (!array_key_exists($char, $unique)) { if (!array_key_exists($char, $unique)) {