remove count from test condition

This commit is contained in:
Arkadiusz Kondas 2016-04-07 23:08:04 +02:00
parent db9d57cd22
commit 9899da7143
2 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "php-ai/php-ml", "name": "php-ai/php-ml",
"type": "library", "type": "library",
"description": "PHP Machine learning library", "description": "PHP Machine Learning library",
"license": "MIT", "license": "MIT",
"keywords": ["machine learning","pattern recognition","computational learning theory","artificial intelligence"], "keywords": ["machine learning","pattern recognition","computational learning theory","artificial intelligence"],
"homepage": "https://github.com/php-ai/php-ml", "homepage": "https://github.com/php-ai/php-ml",

View File

@ -23,8 +23,9 @@ class Distance
} }
$distance = 0; $distance = 0;
$count = count($a);
for ($i = 0; $i < count($a); ++$i) { for ($i = 0; $i < $count; ++$i) {
$distance += pow($a[$i] - $b[$i], 2); $distance += pow($a[$i] - $b[$i], 2);
} }