mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-26 06:46:45 +00:00
fix param casting for hhvm compatibility
This commit is contained in:
parent
3fd5abf566
commit
56114d99ce
@ -49,7 +49,7 @@ class Point implements ArrayAccess
|
||||
$distance += $difference * $difference;
|
||||
}
|
||||
|
||||
return $precise ? sqrt($distance) : $distance;
|
||||
return $precise ? sqrt((float)$distance) : $distance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,6 @@ class Euclidean implements Distance
|
||||
$distance += pow($a[$i] - $b[$i], 2);
|
||||
}
|
||||
|
||||
return sqrt($distance);
|
||||
return sqrt((float)$distance);
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class Matrix
|
||||
for ($j = 0; $j < $this->columns; ++$j) {
|
||||
$subMatrix = $this->crossOut(0, $j);
|
||||
$minor = $this->matrix[0][$j] * $subMatrix->getDeterminant();
|
||||
$determinant += fmod($j, 2) == 0 ? $minor : -$minor;
|
||||
$determinant += fmod((float)$j, 2.0) == 0 ? $minor : -$minor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ class Matrix
|
||||
for ($i = 0; $i < $this->rows; ++$i) {
|
||||
for ($j = 0; $j < $this->columns; ++$j) {
|
||||
$minor = $this->crossOut($i, $j)->getDeterminant();
|
||||
$newMatrix[$i][$j] = fmod($i + $j, 2) == 0 ? $minor : -$minor;
|
||||
$newMatrix[$i][$j] = fmod((float)($i + $j), 2.0) == 0 ? $minor : -$minor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Correlation
|
||||
$b2 = $b2 + pow($b, 2);
|
||||
}
|
||||
|
||||
$corr = $axb / sqrt($a2 * $b2);
|
||||
$corr = $axb / sqrt((float)($a2 * $b2));
|
||||
|
||||
return $corr;
|
||||
}
|
||||
|
@ -39,6 +39,6 @@ class StandardDeviation
|
||||
--$n;
|
||||
}
|
||||
|
||||
return sqrt($carry / $n);
|
||||
return sqrt((float)($carry / $n));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user