vectorized_gaussian#

crispy.scms.vectorized_gaussian(X, G, h)[source]#

Compute Gaussian kernel values for data points relative to walker positions.

This function calculates the Gaussian kernel values for each pair of points in X and G, based on the Euclidean distances between them, and returns both the kernel values and the distances.

Parameters:
  • X (ndarray) – Coordinates of the data points, shape (n, D, 1), where n is the number of points and D is the dimensionality.

  • G (ndarray) – Mean positions (walker coordinates) for the Gaussian kernel, shape (m, D, 1), where m is the number of walkers.

  • h (float) – Smoothing bandwidth of the Gaussian kernel.

Returns:

  • c (ndarray) – Gaussian kernel values for each pair of data point and walker, shape (m, n).

  • distances (ndarray) – Pairwise Euclidean distances between each walker in G and each point in X, shape (m, n).

Notes

This function is optimized to handle pairwise distance calculations and kernel evaluations efficiently.

Examples

Compute Gaussian kernel values and distances:

>>> import numpy as np
>>> from crispy import scms
>>> data = np.random.random((100, 3, 1))  # 3D data points
>>> walkers = np.random.random((10, 3, 1))  # Walker positions
>>> h = 1.0  # Bandwidth
>>> c, distances = scms.vectorized_gaussian(data, walkers, h)
>>> print(c.shape)  # Should be (10, 100)
>>> print(distances.shape)  # Should be (10, 100)