:mod:`heat.spatial` =================== .. py:module:: heat.spatial .. autoapi-nested-parse:: Import files in this folder into the heat.spatial namespace Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 distance/index.rst Package Contents ---------------- .. function:: cdist(X: heat.core.dndarray.DNDarray, Y: heat.core.dndarray.DNDarray = None, quadratic_expansion: bool = False) -> heat.core.dndarray.DNDarray Calculate Euclidian distance between two DNDarrays: .. math:: d(x,y) = \sqrt{(|x-y|^2)} Returns 2D DNDarray of size :math: `m \times n` :param X: 2D array of size :math: `m \times f` :type X: DNDarray :param Y: 2D array of size :math: `n \times f` :type Y: DNDarray :param quadratic_expansion: Whether to use quadratic expansion for :math:`\sqrt{(|x-y|^2)}` (Might yield speed-up) :type quadratic_expansion: bool .. function:: manhattan(X: heat.core.dndarray.DNDarray, Y: heat.core.dndarray.DNDarray = None, expand: bool = False) Calculate Manhattan distance between two DNDarrays: .. math:: d(x,y) = \sum{|x_i-y_i|} Returns 2D DNDarray of size :math: `m \times n` :param X: 2D array of size :math: `m \times f` :type X: DNDarray :param Y: 2D array of size :math: `n \times f` :type Y: DNDarray :param expand: Whether to use dimension expansion (Might yield speed-up) :type expand: bool .. function:: rbf(X: heat.core.dndarray.DNDarray, Y: heat.core.dndarray.DNDarray = None, sigma: float = 1.0, quadratic_expansion: bool = False) -> heat.core.dndarray.DNDarray Calculate Gaussian distance between two DNDarrays: .. math:: d(x,y) = exp(-(|x-y|^2/2\sigma^2) Returns 2D DNDarray of size :math: `m \times n` :param X: 2D array of size :math: `m \times f` :type X: DNDarray :param Y: 2D array of size `n \times f` :type Y: DNDarray :param sigma: Scaling factor for gaussian kernel :type sigma: float :param quadratic_expansion: Whether to use quadratic expansion for :math:`\sqrt{(|x-y|^2)}` (Might yield speed-up) :type quadratic_expansion: bool