mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-22 06:18:41 +00:00
minor code style fixes
This commit is contained in:
parent
f4dcb64af0
commit
7c8469c114
|
|
@ -100,6 +100,18 @@ final class Kmeans
|
|||
return $bestCluster;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cluster centroids
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCentroids() : array
|
||||
{
|
||||
return $this->clusterCenters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
|
|
@ -149,7 +161,7 @@ final class Kmeans
|
|||
|
||||
if ($min !== $point->group) {
|
||||
++$changed;
|
||||
$point->group = ($min);
|
||||
$point->group = $min;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +171,7 @@ final class Kmeans
|
|||
}
|
||||
|
||||
foreach ($clusterCenters as $key => $center) {
|
||||
$center->group = ($key);
|
||||
$center->group = $key;
|
||||
$center->name = (string) $key;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,10 +314,6 @@ final class StringUtils
|
|||
$n1 = \count($from);
|
||||
$n2 = \count($to);
|
||||
|
||||
if ($n1 < 1 || $n2 < 1) {
|
||||
throw new \Exception(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
for ($j = -1; $j < $n2; ++$j) {
|
||||
$dm[-1][$j] = 0;
|
||||
}
|
||||
|
|
@ -328,14 +324,9 @@ final class StringUtils
|
|||
|
||||
for ($i = 0; $i < $n1; ++$i) {
|
||||
for ($j = 0; $j < $n2; ++$j) {
|
||||
if ($from[$i] === $to[$j]) {
|
||||
$ad = $dm[$i - 1][$j - 1];
|
||||
$dm[$i][$j] = $ad + 1;
|
||||
} else {
|
||||
$a1 = $dm[$i - 1][$j];
|
||||
$a2 = $dm[$i][$j - 1];
|
||||
$dm[$i][$j] = \max($a1, $a2);
|
||||
}
|
||||
$dm[$i][$j] = $from[$i] === $to[$j]
|
||||
? $dm[$i - 1][$j - 1] + 1
|
||||
: \max($$dm[$i - 1][$j], $dm[$i][$j - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user