ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_distanceEuclid Module Reference

This module contains procedures and generic interfaces for computing the Euclidean norm of a single point (with respect to origin or a given reference) or the pairwise Euclidean distances (squared) of a collection of points with respect to another set of reference points, optionally without undue overflow or underflow. More...

Data Types

type  euclid_type
 This is a concrete derived type whose instances are exclusively used to request safe method of computing Euclidean distances (without undue overflow or underflow).
More...
 
type  euclidsq_type
 This is a concrete derived type whose instances are exclusively used to request computing Euclidean squared-distances (with the possible risk of overflow or underflow).
More...
 
type  euclidu_type
 This is a concrete derived type whose instances are exclusively used to request unsafe method of computing Euclidean distances (with the possibility of undue overflow or underflow).
More...
 
interface  getDisEuclid
 Generate and return the (squared) Euclidean distance of a (set of) point(s) in ndim-dimensions from a reference point (possibly origin), optionally robustly without underflow or overflow.
More...
 
interface  getDisMatEuclid
 Return the full or a subset of the Euclidean (squared) distance matrix of the input set of npnt points in ndim dimensions. More...
 
interface  setDisEuclid
 Generate and return the (squared) Euclidean distance of a (set of) point(s) in ndim-dimensions from a reference point (possibly origin), optionally robustly without underflow or overflow.
More...
 
interface  setDisMatEuclid
 Return the full or a subset of the Euclidean (squared) distance matrix of the input set of npnt points in ndim dimensions. More...
 

Variables

character(*, SK), parameter MODULE_NAME = "@pm_distanceEuclid"
 
type(euclid_type), parameter euclid = euclid_type()
 This is a scalar parameter object of type euclid_type that is exclusively used to request safe method of computing Euclidean distances (without undue overflow or underflow).
More...
 
type(euclidu_type), parameter euclidu = euclidu_type()
 This is a scalar parameter object of type euclidu_typethat is exclusively used to request unsafe method of computing Euclidean distances (with the possibility of undue overflow or underflow).
More...
 
type(euclidsq_type), parameter euclidsq = euclidsq_type()
 This is a scalar parameter object of type euclidsq_typethat is exclusively used to request computing Euclidean squared-distances (without undue overflow or underflow).
More...
 

Detailed Description

This module contains procedures and generic interfaces for computing the Euclidean norm of a single point (with respect to origin or a given reference) or the pairwise Euclidean distances (squared) of a collection of points with respect to another set of reference points, optionally without undue overflow or underflow.

In mathematics, a norm is a function from a real or complex vector space to the non-negative real numbers that behaves in certain ways like the distance from the origin.
It commutes with scaling, obeys a form of the triangle inequality, and is zero only at the origin.
In particular, the Euclidean distance of a vector from the origin is a norm, called the Euclidean norm, or 2-norm.
It is commonly defined as the square root of the inner product of a vector with itself.

Usage Directions

  1. Use getDisEuclid functional generic interface to compute distance of a (set of) point(s) from the origin or a (set of) reference(s), optionally without undue overflow/underflow.
  2. Use getDisMatEuclid functional generic interface or the equivalent faster setDisMatEuclid procedural generic interface to compute pairwise (squared) Euclidean distances (i.e., the distance matrix) of a set of points (with or without undue overflow/underflow).
See also
pm_distanceMahal
pm_distanceHellinger
pm_distanceManhattan
pm_distanceMinkowski
Developer Remark:
While it is possible to merge the generic interfaces for computing the Euclidean, Minkowski, Manhattan, and other distances into a single module, the decision was made not to do so, as each of these metrics require certain parameters that are distinct from other methods.
In such a case, there is no point in merging disparate procedures under a single generic interface name.
Test:
test_pm_distanceEuclid
Todo:
High Priority: The connection between the different packing schemes of the distance matrix and the packing methods in pm_matrixPack must be further clarified.
Todo:
Normal Priority: A comparison and benchmark with faster less numerically-stable computational methods for pairwise distances might be informative here.
See also a relevant discussion in stackexchange.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Oct 16, 2022, 2:38 AM, Dallas, TX

Variable Documentation

◆ euclid

type(euclid_type), parameter pm_distanceEuclid::euclid = euclid_type()

This is a scalar parameter object of type euclid_type that is exclusively used to request safe method of computing Euclidean distances (without undue overflow or underflow).

This scalar parameter object is exclusively used to differentiate the procedures within the getDisMatEuclid and setDisMatEuclid generic interfaces.
See getDisMatEuclid and setDisMatEuclid for example usage.

See also
euclid
euclidu
euclidsq
euclid_type
euclidu_type
euclidsq_type
getDisEuclid
getDisMatEuclid
setDisMatEuclid


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 143 of file pm_distanceEuclid.F90.

◆ euclidsq

type(euclidsq_type), parameter pm_distanceEuclid::euclidsq = euclidsq_type()

This is a scalar parameter object of type euclidsq_typethat is exclusively used to request computing Euclidean squared-distances (without undue overflow or underflow).

This scalar parameter object is exclusively used to differentiate the procedures within the getDisMatEuclid and setDisMatEuclid generic interfaces.
See getDisMatEuclid and setDisMatEuclid for example usage.

See also
euclid
euclidu
euclidsq
euclid_type
euclidu_type
euclidsq_type
getDisEuclid
getDisMatEuclid
setDisMatEuclid


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 271 of file pm_distanceEuclid.F90.

Referenced by test_pm_knn::test_getHub_1(), test_pm_knn::test_getPairDistSq_1(), and test_pm_statest::test_Uniformity().

◆ euclidu

type(euclidu_type), parameter pm_distanceEuclid::euclidu = euclidu_type()

This is a scalar parameter object of type euclidu_typethat is exclusively used to request unsafe method of computing Euclidean distances (with the possibility of undue overflow or underflow).

This scalar parameter object is exclusively used to differentiate the procedures within the getDisMatEuclid and setDisMatEuclid generic interfaces.
See getDisMatEuclid and setDisMatEuclid for example usage.

See also
euclid
euclidu
euclidsq
euclid_type
euclidu_type
euclidsq_type
getDisEuclid
getDisMatEuclid
setDisMatEuclid


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 207 of file pm_distanceEuclid.F90.

Referenced by test_pm_statest::test_Uniformity().

◆ MODULE_NAME

character(*, SK), parameter pm_distanceEuclid::MODULE_NAME = "@pm_distanceEuclid"

Definition at line 82 of file pm_distanceEuclid.F90.