### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Spatial algorithms and data structures (`scipy.spatial`) »
- Distance computations (`scipy.spatial.distance`) »

# scipy.spatial.distance.is_valid_dm

`scipy.spatial.distance.``is_valid_dm`(D, tol=0.0, throw=False, name='D', warning=False)

  Returns True if the variable D passed is a valid distance matrix. Distance matrices must be 2-dimensional numpy arrays containing doubles. They must have a zero-diagonal, and they must be symmetric.

  Parameters : | D : ndarray The candidate object to test for validity. tol : double The distance matrix should be symmetric. tol is the maximum difference between the :math:`ij`th entry and the :math:`ji`th entry for the distance metric to be considered symmetric. throw : bool An exception is thrown if the distance matrix passed is not valid. name : string the name of the variable to checked. This is useful ifa throw is set to `True` so the offending variable can be identified in the exception message when an exception is thrown. warning : boolx Instead of throwing an exception, a warning message is raised.
  Returns : | Returns ``True`` if the variable ``D`` passed is a valid : distance matrix. Small numerical differences in ``D`` and : ``D.T`` and non-zeroness of the diagonal are ignored if they are : within the tolerance specified by ``tol``. :

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Spatial algorithms and data structures (`scipy.spatial`) »
- Distance computations (`scipy.spatial.distance`) »