mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 14:08:40 +00:00
fix tests
This commit is contained in:
parent
f435905146
commit
1e197375c5
|
|
@ -87,6 +87,6 @@ final class Illinois
|
||||||
++$iteration;
|
++$iteration;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($a + $b) / 2;
|
return $c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,6 @@ final class RegulaFalsi
|
||||||
++$iteration;
|
++$iteration;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($a + $b) / 2;
|
return $c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace phpOMS\Math\Topology;
|
||||||
/**
|
/**
|
||||||
* Kernels.
|
* Kernels.
|
||||||
*
|
*
|
||||||
* The bandwidth in the following functions is equivalent with sigma.
|
* The bandwidth in the following functions is equivalent with 2 * sigma.
|
||||||
*
|
*
|
||||||
* @package phpOMS\Math\Topology
|
* @package phpOMS\Math\Topology
|
||||||
* @license OMS License 2.0
|
* @license OMS License 2.0
|
||||||
|
|
@ -82,10 +82,10 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function epanechnikovKernel(float $distance, float $bandwidth) : float
|
public static function epanechnikovKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
if (\abs($distance) <= $bandwidth) {
|
if (\abs($distance) <= $bandwidth / 2) {
|
||||||
$u = \abs($distance) / $bandwidth;
|
$u = \abs($distance) / ($bandwidth / 2);
|
||||||
|
|
||||||
return 0.75 * (1 - $u * $u) / $bandwidth;
|
return 0.75 * (1 - $u * $u) / ($bandwidth / 2);
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -103,10 +103,10 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function quarticKernel(float $distance, float $bandwidth) : float
|
public static function quarticKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
if (\abs($distance) <= $bandwidth) {
|
if (\abs($distance) <= $bandwidth / 2) {
|
||||||
$u = \abs($distance) / $bandwidth;
|
$u = \abs($distance) / ($bandwidth / 2);
|
||||||
|
|
||||||
return (15 / 16) * (1 - $u * $u) * (1 - $u * $u) / $bandwidth;
|
return (15 / 16) * (1 - $u * $u) * (1 - $u * $u) / ($bandwidth / 2);
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -124,10 +124,10 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function triweightKernel(float $distance, float $bandwidth) : float
|
public static function triweightKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
if (\abs($distance) <= $bandwidth) {
|
if (\abs($distance) <= $bandwidth / 2) {
|
||||||
$u = \abs($distance) / $bandwidth;
|
$u = \abs($distance) / ($bandwidth / 2);
|
||||||
|
|
||||||
return (35 / 32) * (1 - $u * $u) * (1 - $u * $u) * (1 - $u * $u) / $bandwidth;
|
return (35 / 32) * (1 - $u * $u) * (1 - $u * $u) * (1 - $u * $u) / ($bandwidth / 2);
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -145,10 +145,10 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function tricubeKernel(float $distance, float $bandwidth) : float
|
public static function tricubeKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
if (\abs($distance) <= $bandwidth) {
|
if (\abs($distance) <= $bandwidth / 2) {
|
||||||
$u = \abs($distance) / $bandwidth;
|
$u = \abs($distance) / ($bandwidth / 2);
|
||||||
|
|
||||||
return (70 / 81) * (1 - $u * $u * $u) * (1 - $u * $u * $u) * (1 - $u * $u * $u) / $bandwidth;
|
return (70 / 81) * (1 - $u * $u * $u) * (1 - $u * $u * $u) * (1 - $u * $u * $u) / ($bandwidth / 2);
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -181,8 +181,8 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function cosineKernel(float $distance, float $bandwidth) : float
|
public static function cosineKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
return \abs($distance) <= $bandwidth
|
return \abs($distance) <= $bandwidth / 2
|
||||||
? (\M_PI / 4) * \cos(\M_PI * $distance / (2 * $bandwidth)) / $bandwidth
|
? (\M_PI / 4) * \cos(\M_PI * $distance / $bandwidth) / ($bandwidth / 2)
|
||||||
: 0.0;
|
: 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,6 +198,6 @@ final class Kernel2D
|
||||||
*/
|
*/
|
||||||
public static function logisticKernel(float $distance, float $bandwidth) : float
|
public static function logisticKernel(float $distance, float $bandwidth) : float
|
||||||
{
|
{
|
||||||
return 1 / (\exp($distance / $bandwidth) + 2 + \exp(-$distance / $bandwidth));
|
return 1 / (\exp($distance / ($bandwidth / 2)) + 2 + \exp(-$distance / ($bandwidth / 2)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getData(mixed $key, string $type = null) : mixed
|
public function getData(mixed $key = null, string $type = null) : mixed
|
||||||
{
|
{
|
||||||
if ($key === null) {
|
if ($key === null) {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user