hessband.kernels.kernel_derivatives(u: ndarray, h: float, kernel: str) tuple[ndarray, ndarray, ndarray][source]

Computes kernel weights and their derivatives.

Derivatives are with respect to the bandwidth h and ignore support-boundary motion for compact kernels, which is the standard practical convention.

Parameters:
  • u – Normalized pairwise distances (x - x’) / h.

  • h – Bandwidth (> 0).

  • kernel – Kernel name (“gaussian”, “epanechnikov”, or “epan”).

Returns:

  • w: The kernel weights K(u) / h.

  • dw: The first derivative d/dh [K(u) / h].

  • d2w: The second derivative d^2/dh^2 [K(u) / h].

Return type:

A tuple containing

hessband.kernels.kernel_weights(u: ndarray, h: float, kernel: str) ndarray[source]

Computes kernel weights K(u)/h for a given kernel.

Parameters:
  • u – Normalized pairwise distances (x - x’) / h.

  • h – Bandwidth (> 0).

  • kernel – Kernel name (“gaussian”, “epanechnikov”, or “epan”).

Returns:

The kernel weights K(u) / h.

hessband.kernels.weights_epanechnikov(u: ndarray, h: float) ndarray[source]

Computes Epanechnikov kernel weights.

Parameters:
  • u – Normalized distances (x - x’) / h.

  • h – Bandwidth (> 0).

Returns:

The kernel weights K(u) / h for the Epanechnikov kernel.

hessband.kernels.weights_gaussian(u: ndarray, h: float) ndarray[source]

Computes Gaussian kernel weights.

Parameters:
  • u – Normalized distances (x - x’) / h.

  • h – Bandwidth (> 0).

Returns:

The kernel weights K(u) / h for the Gaussian kernel.