[Scipy-svn] r5096 - in trunk/scipy: cluster odr optimize spatial

scipy-svn@scip... scipy-svn@scip...
Thu Nov 13 16:23:16 CST 2008


Author: ptvirtan
Date: 2008-11-13 16:22:59 -0600 (Thu, 13 Nov 2008)
New Revision: 5096

Modified:
   trunk/scipy/cluster/hierarchy.py
   trunk/scipy/odr/odrpack.py
   trunk/scipy/optimize/optimize.py
   trunk/scipy/spatial/distance.py
Log:
Fix docstrings that made Sphinx to fail

Modified: trunk/scipy/cluster/hierarchy.py
===================================================================
--- trunk/scipy/cluster/hierarchy.py	2008-11-13 21:47:30 UTC (rev 5095)
+++ trunk/scipy/cluster/hierarchy.py	2008-11-13 22:22:59 UTC (rev 5096)
@@ -435,46 +435,46 @@
 
 
 def linkage(y, method='single', metric='euclidean'):
-    """
+    r"""
     Performs hierarchical/agglomerative clustering on the
-    condensed distance matrix y. y must be a {n \choose 2} sized
+    condensed distance matrix y. y must be a :math:`{n \choose 2}` sized
     vector where n is the number of original observations paired
     in the distance matrix. The behavior of this function is very
     similar to the MATLAB(TM) linkage function.
 
-    A 4 by :math:`$(n-1)$` matrix ``Z`` is returned. At the
-    :math:`$i$`th iteration, clusters with indices ``Z[i, 0]`` and
-    ``Z[i, 1]`` are combined to form cluster :math:`$n + i$`. A
-    cluster with an index less than :math:`$n$` corresponds to one of
-    the :math:`$n$` original observations. The distance between
+    A 4 by :math:`(n-1)` matrix ``Z`` is returned. At the
+    :math:`i`-th iteration, clusters with indices ``Z[i, 0]`` and
+    ``Z[i, 1]`` are combined to form cluster :math:`n + i`. A
+    cluster with an index less than :math:`n` corresponds to one of
+    the :math:`n` original observations. The distance between
     clusters ``Z[i, 0]`` and ``Z[i, 1]`` is given by ``Z[i, 2]``. The
     fourth value ``Z[i, 3]`` represents the number of original
     observations in the newly formed cluster.
 
     The following linkage methods are used to compute the distance
-    :math:`$d(s, t)$` between two clusters :math:`$s$` and
-    :math:`$t$`. The algorithm begins with a forest of clusters that
+    :math:`d(s, t)` between two clusters :math:`s` and
+    :math:`t`. The algorithm begins with a forest of clusters that
     have yet to be used in the hierarchy being formed. When two
-    clusters :math:`$s$` and :math:`$t$` from this forest are combined
-    into a single cluster :math:`$u$`, :math:`$s$` and :math:`$t$` are
-    removed from the forest, and :math:`$u$` is added to the
+    clusters :math:`s` and :math:`t` from this forest are combined
+    into a single cluster :math:`u`, :math:`s` and :math:`t` are
+    removed from the forest, and :math:`u` is added to the
     forest. When only one cluster remains in the forest, the algorithm
     stops, and this cluster becomes the root.
 
     A distance matrix is maintained at each iteration. The ``d[i,j]``
-    entry corresponds to the distance between cluster :math:`$i$` and
-    :math:`$j$` in the original forest.
+    entry corresponds to the distance between cluster :math:`i` and
+    :math:`j` in the original forest.
 
     At each iteration, the algorithm must update the distance matrix
     to reflect the distance of the newly formed cluster u with the
     remaining clusters in the forest.
 
-    Suppose there are :math:`$|u|$` original observations
-    :math:`$u[0], \ldots, u[|u|-1]$` in cluster :math:`$u$` and
-    :math:`$|v|$` original objects :math:`$v[0], \ldots, v[|v|-1]$` in
-    cluster :math:`$v$`. Recall :math:`$s$` and :math:`$t$` are
-    combined to form cluster :math:`$u$`. Let :math:`$v$` be any
-    remaining cluster in the forest that is not :math:`$u$`.
+    Suppose there are :math:`|u|` original observations
+    :math:`u[0], \ldots, u[|u|-1]` in cluster :math:`u` and
+    :math:`|v|` original objects :math:`v[0], \ldots, v[|v|-1]` in
+    cluster :math:`v`. Recall :math:`s` and :math:`t` are
+    combined to form cluster :math:`u`. Let :math:`v` be any
+    remaining cluster in the forest that is not :math:`u`.
 
     :Parameters:
        Q : ndarray
@@ -482,8 +482,8 @@
            distance matrix is a flat array containing the upper
            triangular of the distance matrix. This is the form that
            ``pdist`` returns. Alternatively, a collection of
-           :math:`$m$` observation vectors in n dimensions may be passed as
-           a :math:`$m$` by :math:`$n$` array.
+           :math:`m` observation vectors in n dimensions may be passed as
+           a :math:`m` by :math:`n` array.
        method : string
            The linkage algorithm to use. See the ``Linkage Methods``
            section below for full descriptions.
@@ -495,15 +495,15 @@
     ---------------
 
     The following are methods for calculating the distance between the
-    newly formed cluster :math:`$u$` and each :math:`$v$`.
+    newly formed cluster :math:`u` and each :math:`v`.
 
     * method=``single`` assigns
 
       .. math:
          d(u,v) = \min(dist(u[i],v[j]))
 
-      for all points :math:`$i$` in cluster :math:`$u$` and
-      :math:`$j$` in cluster :math:`$v$`. This is also known as the
+      for all points :math:`i` in cluster :math:`u` and
+      :math:`j` in cluster :math:`v`. This is also known as the
       Nearest Point Algorithm.
 
     * method=``complete`` assigns
@@ -511,8 +511,8 @@
       .. math:
          d(u, v) = \max(dist(u[i],v[j]))
 
-      for all points :math:`$i$` in cluster u and :math:`$j$` in
-      cluster :math:`$v$`. This is also known by the Farthest Point
+      for all points :math:`i` in cluster u and :math:`j` in
+      cluster :math:`v`. This is also known by the Farthest Point
       Algorithm or Voor Hees Algorithm.
 
     * method=``average`` assigns
@@ -521,9 +521,9 @@
          d(u,v) = \sum_{ij} \frac{d(u[i], v[j])}
                                  {(|u|*|v|)
 
-      for all points :math:`$i$` and :math:`$j$` where :math:`$|u|$`
-      and :math:`$|v|$` are the cardinalities of clusters :math:`$u$`
-      and :math:`$v$`, respectively. This is also called the UPGMA
+      for all points :math:`i` and :math:`j` where :math:`|u|`
+      and :math:`|v|` are the cardinalities of clusters :math:`u`
+      and :math:`v`, respectively. This is also called the UPGMA
       algorithm. This is called UPGMA.
 
     * method='weighted' assigns
@@ -540,24 +540,24 @@
       .. math:
          dist(s,t) = euclid(c_s, c_t)
 
-      where :math:`$c_s$` and :math:`$c_t$` are the centroids of
-      clusters :math:`$s$` and :math:`$t$`, respectively. When two
-      clusters :math:`$s$` and :math:`$t$` are combined into a new
-      cluster :math:`$u$`, the new centroid is computed over all the
-      original objects in clusters :math:`$s$` and :math:`$t$`. The
+      where :math:`c_s` and :math:`c_t` are the centroids of
+      clusters :math:`s` and :math:`t`, respectively. When two
+      clusters :math:`s` and :math:`t` are combined into a new
+      cluster :math:`u`, the new centroid is computed over all the
+      original objects in clusters :math:`s` and :math:`t`. The
       distance then becomes the Euclidean distance between the
-      centroid of :math:`$u$` and the centroid of a remaining cluster
-      :math:`$v$` in the forest. This is also known as the UPGMC
+      centroid of :math:`u` and the centroid of a remaining cluster
+      :math:`v` in the forest. This is also known as the UPGMC
       algorithm.
 
     * method='median' assigns math:`$d(s,t)$` like the ``centroid``
       method. When two clusters s and t are combined into a new
-      cluster :math:`$u$`, the average of centroids s and t give the
-      new centroid :math:`$u$`. This is also known as the WPGMC
+      cluster :math:`u`, the average of centroids s and t give the
+      new centroid :math:`u`. This is also known as the WPGMC
       algorithm.
 
     * method='ward' uses the Ward variance minimization algorithm.
-      The new entry :math:`$d(u,v)$` is computed as follows,
+      The new entry :math:`d(u,v)` is computed as follows,
 
       .. math:
 
@@ -568,10 +568,10 @@
                       + \frac{|v|}
                              {T}d(s,t)^2}
 
-      where :math:`$u$` is the newly joined cluster consisting of
-      clusters :math:`$s$` and :math:`$t$`, :math:`$v$` is an unused
-      cluster in the forest, :math:`$T=|v|+|s|+|t|$`, and
-      :math:`$|*|$` is the cardinality of its argument. This is also
+      where :math:`u` is the newly joined cluster consisting of
+      clusters :math:`s` and :math:`t`, :math:`v` is an unused
+      cluster in the forest, :math:`T=|v|+|s|+|t|`, and
+      :math:`|*|` is the cardinality of its argument. This is also
       known as the incremental algorithm.
 
    Warning
@@ -653,12 +653,12 @@
             self.count = left.count + right.count
 
     def get_id(self):
-        """
-        The identifier of the target node. For :math:`$0 leq i < n$`,
-        :math:`$i$` corresponds to original observation
-        :math:`$i$`. For :math:`$n \leq i$` < :math:`$2n-1$`,
-        :math:`$i$` corresponds to non-singleton cluster formed at
-        iteration :math:`$i-n$`.
+        r"""
+        The identifier of the target node. For :math:`0 \leq i < n`,
+        :math:`i` corresponds to original observation
+        :math:`i`. For :math:`n \leq i` < :math:`2n-1`,
+        :math:`i` corresponds to non-singleton cluster formed at
+        iteration :math:`i-n`.
 
         :Returns:
 
@@ -896,7 +896,7 @@
        - Y : ndarray (optional)
          Calculates the cophenetic correlation coefficient ``c`` of a
          hierarchical clustering defined by the linkage matrix ``Z``
-         of a set of :math:`$n$` observations in :math:`$m$`
+         of a set of :math:`n` observations in :math:`m`
          dimensions. ``Y`` is the condensed distance matrix from which
          ``Z`` was generated.
 
@@ -906,8 +906,8 @@
 
        - d : ndarray
          The cophenetic distance matrix in condensed form. The
-         :math:`$ij$` th entry is the cophenetic distance between
-         original observations :math:`$i$` and :math:`$j$`.
+         :math:`ij` th entry is the cophenetic distance between
+         original observations :math:`i` and :math:`j`.
 
     """
 
@@ -942,7 +942,7 @@
     return (c, zz)
 
 def inconsistent(Z, d=2):
-    """
+    r"""
     Calculates inconsistency statistics on a linkage.
 
     :Parameters:
@@ -951,17 +951,17 @@
            non-singleton cluster
 
        - Z : ndarray
-           The :math:`$(n-1)$` by 4 matrix encoding the linkage
+           The :math:`(n-1)` by 4 matrix encoding the linkage
            (hierarchical clustering).  See ``linkage`` documentation
            for more information on its form.
 
 
     :Returns:
        - R : ndarray
-           A :math:`$(n-1)$` by 5 matrix where the ``i``'th row
+           A :math:`(n-1)` by 5 matrix where the ``i``'th row
            contains the link statistics for the non-singleton cluster
            ``i``. The link statistics are computed over the link
-           heights for links :math:`$d$` levels below the cluster
+           heights for links :math:`d` levels below the cluster
            ``i``. ``R[i,0]`` and ``R[i,1]`` are the mean and standard
            deviation of the link heights, respectively; ``R[i,2]`` is
            the number of links included in the calculation; and
@@ -1070,7 +1070,7 @@
 def is_monotonic(Z):
     """
     Returns ``True`` if the linkage passed is monotonic. The linkage
-    is monotonic if for every cluster :math:`$s$` and :math:`$t$`
+    is monotonic if for every cluster :math:`s` and :math:`t`
     joined, the distance between them is no less than the distance
     between any previously joined clusters.
 
@@ -1092,9 +1092,9 @@
     """
 
     Returns True if the inconsistency matrix passed is valid. It must
-    be a :math:`$n$` by 4 numpy array of doubles. The standard
+    be a :math:`n` by 4 numpy array of doubles. The standard
     deviations ``R[:,1]`` must be nonnegative. The link counts
-    ``R[:,2]`` must be positive and no greater than :math:`$n-1$`.
+    ``R[:,2]`` must be positive and no greater than :math:`n-1`.
 
     :Arguments:
          - R : ndarray
@@ -1153,13 +1153,13 @@
     return valid
 
 def is_valid_linkage(Z, warning=False, throw=False, name=None):
-    """
+    r"""
     Checks the validity of a linkage matrix. A linkage matrix is valid
-    if it is a two dimensional nd-array (type double) with :math:`$n$`
+    if it is a two dimensional nd-array (type double) with :math:`n`
     rows and 4 columns.  The first two columns must contain indices
-    between 0 and :math:`$2n-1$`. For a given row ``i``,
-    :math:`$0 \leq \mathtt{Z[i,0]} \leq i+n-1$` and
-    :math:`$0 \leq Z[i,1] \leq i+n-1$` (i.e.  a cluster
+    between 0 and :math:`2n-1`. For a given row ``i``,
+    :math:`0 \leq \mathtt{Z[i,0]} \leq i+n-1` and
+    :math:`0 \leq Z[i,1] \leq i+n-1` (i.e.  a cluster
     cannot join another cluster unless the cluster being joined has
     been generated.)
 

Modified: trunk/scipy/odr/odrpack.py
===================================================================
--- trunk/scipy/odr/odrpack.py	2008-11-13 21:47:30 UTC (rev 5095)
+++ trunk/scipy/odr/odrpack.py	2008-11-13 22:22:59 UTC (rev 5096)
@@ -873,9 +873,9 @@
         default value from class initialization is for all of these options set
         to 0.
 
-        _______________________________________________________________________
+        =========  =====  =====================================================
         Parameter  Value  Meaning
-        ---------  -----  -------
+        =========  =====  =====================================================
         fit_type     0    explicit ODR
                      1    implicit ODR
                      2    ordinary least-squares
@@ -898,7 +898,7 @@
 
         restart      0    fit is not a restart
                      1    fit is a restart
-        _______________________________________________________________________
+        =========  =====  =====================================================
 
         The permissible values are different from those given on pg. 31 of the
         ODRPACK User's Guide only in that one cannot specify numbers greater than the

Modified: trunk/scipy/optimize/optimize.py
===================================================================
--- trunk/scipy/optimize/optimize.py	2008-11-13 21:47:30 UTC (rev 5095)
+++ trunk/scipy/optimize/optimize.py	2008-11-13 22:22:59 UTC (rev 5096)
@@ -1457,9 +1457,8 @@
             Number of objective function evaluations made.
 
     Notes
+    -----
 
-    ----------------------------
-
     Uses inverse parabolic interpolation when possible to speed up convergence
     of golden section method.
 

Modified: trunk/scipy/spatial/distance.py
===================================================================
--- trunk/scipy/spatial/distance.py	2008-11-13 21:47:30 UTC (rev 5095)
+++ trunk/scipy/spatial/distance.py	2008-11-13 22:22:59 UTC (rev 5096)
@@ -175,7 +175,7 @@
     return X
 
 def minkowski(u, v, p):
-    """
+    r"""
     Computes the Minkowski distance between two vectors ``u`` and ``v``,
     defined as
 
@@ -189,7 +189,7 @@
        v : ndarray
            An n-dimensional vector.
        p : ndarray
-           The norm of the difference :math:`${||u-v||}_p$`.
+           The norm of the difference :math:`{||u-v||}_p`.
 
     :Returns:
        d : double
@@ -202,7 +202,7 @@
     return (abs(u-v)**p).sum() ** (1.0 / p)
 
 def wminkowski(u, v, p, w):
-    """
+    r"""
     Computes the weighted Minkowski distance between two vectors ``u``
     and ``v``, defined as
 
@@ -216,7 +216,7 @@
        v : ndarray
            An :math:`n`-dimensional vector.
        p : ndarray
-           The norm of the difference :math:`${||u-v||}_p$`.
+           The norm of the difference :math:`{||u-v||}_p`.
        w : ndarray
            The weight vector.
 
@@ -279,7 +279,7 @@
     return ((u-v)*(u-v).T).sum()
 
 def cosine(u, v):
-    """
+    r"""
     Computes the Cosine distance between two n-vectors u and v, which
     is defined as
 
@@ -303,7 +303,7 @@
                    (np.sqrt(np.dot(u, u.T)) * np.sqrt(np.dot(v, v.T)))))
 
 def correlation(u, v):
-    """
+    r"""
     Computes the correlation distance between two n-vectors ``u`` and
     ``v``, which is defined as
 
@@ -312,7 +312,7 @@
        \frac{1 - (u - n{|u|}_1){(v - n{|v|}_1)}^T}
             {{|(u - n{|u|}_1)|}_2 {|(v - n{|v|}_1)|}^T}
 
-    where :math:`$|*|_1$` is the Manhattan norm and ``n`` is the
+    where :math:`|*|_1` is the Manhattan norm and ``n`` is the
     common dimensionality of the vectors.
 
     :Parameters:
@@ -334,7 +334,7 @@
                    * np.sqrt(np.dot(vm, vm))))
 
 def hamming(u, v):
-    """
+    r"""
     Computes the Hamming distance between two n-vectors ``u`` and
     ``v``, which is simply the proportion of disagreeing components in
     ``u`` and ``v``. If ``u`` and ``v`` are boolean vectors, the Hamming
@@ -344,9 +344,9 @@
 
        \frac{c_{01} + c_{10}}{n}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -372,9 +372,9 @@
        \frac{c_{TF} + c_{FT}}
             {c_{TT} + c_{FT} + c_{TF}}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -402,9 +402,9 @@
        \frac{c_{TF} + c_{FT} - c_{TT} + n}
             {c_{FT} + c_{TF} + n}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -478,7 +478,7 @@
     .. math:
        (u-v)V^{-1}(u-v)^T
 
-    where ``VI`` is the inverse covariance matrix :math:`$V^{-1}$`.
+    where ``VI`` is the inverse covariance matrix :math:`V^{-1}`.
 
     :Parameters:
        u : ndarray
@@ -614,9 +614,9 @@
          \frac{R}
          \frac{c_{TT} + c_{FF} + \frac{R}{2}}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$` and :math:`$R = 2.0 * (c_{TF} + c_{FT})$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n` and :math:`R = 2.0 * (c_{TF} + c_{FT})`.
 
     :Parameters:
        u : ndarray
@@ -642,9 +642,9 @@
 
        \frac{c_{TF} + c_{FT}}{n}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -671,9 +671,9 @@
          \frac{c_{TF} + c_{FT}
               {2c_{TT} + c_{FT} + c_{TF}}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -703,9 +703,9 @@
        \frac{R}
             {c_{TT} + c_{FF} + R}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$` and :math:`$R = 2(c_{TF} + c_{FT})$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n` and :math:`R = 2(c_{TF} + c_{FT})`.
 
     :Parameters:
        u : ndarray
@@ -733,9 +733,9 @@
       \frac{n - c_{TT}}
            {n}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`.
 
     :Parameters:
        u : ndarray
@@ -765,10 +765,10 @@
        \frac{2R}
             {S + 2R}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$`, :math:`$R = 2 * (c_{TF} + c{FT})$` and
-    :math:`$S = c_{FF} + c_{TT}$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n`, :math:`R = 2 * (c_{TF} + c{FT})` and
+    :math:`S = c_{FF} + c_{TT}`.
 
     :Parameters:
        u : ndarray
@@ -801,9 +801,9 @@
        \frac{2R}
             {c_{TT} + 2R}
 
-    where :math:`$c_{ij}$` is the number of occurrences of
-    :math:`$\mathtt{u[k]}` = i$ and :math:`$\mathtt{v[k]} = j$` for
-    :math:`$k < n$` and :math:`$R = 2(c_{TF} + c{FT})$`.
+    where :math:`c_{ij}` is the number of occurrences of
+    :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for
+    :math:`k < n` and :math:`R = 2(c_{TF} + c{FT})`.
 
     :Parameters:
        u : ndarray
@@ -829,7 +829,7 @@
     """
     Computes the pairwise distances between m original observations in
     n-dimensional space. Returns a condensed distance matrix Y.  For
-    each :math:`$i$` and :math:`$j$` (where :math:`$i<j<n$), the
+    each :math:`i` and :math:`j` (where :math:`i<j<n`), the
     metric ``dist(u=X[i], v=X[j])`` is computed and stored in the
     :math:`ij`th entry.
 
@@ -873,7 +873,7 @@
     2. ``Y = pdist(X, 'minkowski', p)``
 
        Computes the distances using the Minkowski distance
-       :math:`$||u-v||_p$` (p-norm) where :math:`$p \geq 1$`.
+       :math:`||u-v||_p` (p-norm) where :math:`p \geq 1`.
 
     3. ``Y = pdist(X, 'cityblock')``
 
@@ -918,8 +918,8 @@
           \frac{1 - (u - n{|u|}_1){(v - n{|v|}_1)}^T}
                {{|(u - n{|u|}_1)|}_2 {|(v - n{|v|}_1)|}^T}
 
-       where :math:`$|*|_1$` is the Manhattan (or 1-norm) of its
-       argument, and :math:`$n$` is the common dimensionality of the
+       where :math:`|*|_1` is the Manhattan (or 1-norm) of its
+       argument, and :math:`n` is the common dimensionality of the
        vectors.
 
     8. ``Y = pdist(X, 'hamming')``
@@ -973,7 +973,7 @@
 
        Computes the Mahalanobis distance between the points. The
        Mahalanobis distance between two points ``u`` and ``v`` is
-       :math:`$(u-v)(1/V)(u-v)^T$` where :math:`$(1/V)$` (the ``VI``
+       :math:`(u-v)(1/V)(u-v)^T` where :math:`(1/V)` (the ``VI``
        variable) is the inverse covariance. If ``VI`` is not None,
        ``VI`` will be used as the inverse covariance matrix.
 
@@ -1038,7 +1038,7 @@
 
        would calculate the pair-wise distances between the vectors in
        X using the Python function sokalsneath. This would result in
-       sokalsneath being called :math:`${n \choose 2}$` times, which
+       sokalsneath being called :math:`{n \choose 2}` times, which
        is inefficient. Instead, the optimized C version is more
        efficient, and we call it using the following syntax.::
 
@@ -1295,7 +1295,7 @@
     1. v = squareform(X)
 
        Given a square d by d symmetric distance matrix ``X``,
-       ``v=squareform(X)`` returns a :math:`$d*(d-1)/2$` (or
+       ``v=squareform(X)`` returns a :math:`d*(d-1)/2` (or
        `${n \choose 2}$`) sized vector v.
 
       v[{n \choose 2}-{n-i \choose 2} + (j-i-1)] is the distance
@@ -1389,8 +1389,8 @@
            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
+           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
@@ -1459,7 +1459,7 @@
     Returns ``True`` if the variable ``y`` passed is a valid condensed
     distance matrix. Condensed distance matrices must be 1-dimensional
     numpy arrays containing doubles. Their length must be a binomial
-    coefficient :math:`${n \choose 2}$` for some positive integer n.
+    coefficient :math:`{n \choose 2}` for some positive integer n.
 
 
     :Parameters:
@@ -1559,29 +1559,29 @@
 def cdist(XA, XB, metric='euclidean', p=2, V=None, VI=None, w=None):
     """
     Computes distance between each pair of observations between two
-    collections of vectors. ``XA`` is a :math:`$m_A$` by :math:`$n$`
-    array while ``XB`` is a :math:`$m_B$` by :math:`$n$` array. A
-    :math:`$m_A$` by :math:`$m_B$` array is returned. An exception is
+    collections of vectors. ``XA`` is a :math:`m_A` by :math:`n`
+    array while ``XB`` is a :math:`m_B` by :math:`n` array. A
+    :math:`m_A` by :math:`m_B` array is returned. An exception is
     thrown if ``XA`` and ``XB`` do not have the same number of
     columns.
 
-    A rectangular distance matrix ``Y`` is returned. For each :math:`$i$`
-    and :math:`$j$`, the metric ``dist(u=XA[i], v=XB[j])`` is computed
-    and stored in the :math:`$ij$` th entry.
+    A rectangular distance matrix ``Y`` is returned. For each :math:`i`
+    and :math:`j`, the metric ``dist(u=XA[i], v=XB[j])`` is computed
+    and stored in the :math:`ij` th entry.
 
     The following are common calling conventions:
 
     1. ``Y = cdist(X, 'euclidean')``
 
-       Computes the distance between :math:`$m$` points using
+       Computes the distance between :math:`m` points using
        Euclidean distance (2-norm) as the distance metric between the
-       points. The points are arranged as :math:`$m$`
-       :math:`$n$`-dimensional row vectors in the matrix X.
+       points. The points are arranged as :math:`m`
+       :math:`n`-dimensional row vectors in the matrix X.
 
     2. ``Y = cdist(X, 'minkowski', p)``
 
        Computes the distances using the Minkowski distance
-       :math:`$||u-v||_p$` (:math:`$p$`-norm) where :math:`$p \geq 1$`.
+       :math:`||u-v||_p` (:math:`p`-norm) where :math:`p \geq 1`.
 
     3. ``Y = cdist(X, 'cityblock')``
 
@@ -1626,8 +1626,8 @@
           \frac{1 - (u - n{|u|}_1){(v - n{|v|}_1)}^T}
                {{|(u - n{|u|}_1)|}_2 {|(v - n{|v|}_1)|}^T}
 
-       where :math:`$|*|_1$` is the Manhattan (or 1-norm) of its
-       argument, and :math:`$n$` is the common dimensionality of the
+       where :math:`|*|_1` is the Manhattan (or 1-norm) of its
+       argument, and :math:`n` is the common dimensionality of the
        vectors.
 
     8. ``Y = cdist(X, 'hamming')``
@@ -1681,7 +1681,7 @@
 
        Computes the Mahalanobis distance between the points. The
        Mahalanobis distance between two points ``u`` and ``v`` is
-       :math:`$(u-v)(1/V)(u-v)^T$` where :math:`$(1/V)$` (the ``VI``
+       :math:`(u-v)(1/V)(u-v)^T` where :math:`(1/V)` (the ``VI``
        variable) is the inverse covariance. If ``VI`` is not None,
        ``VI`` will be used as the inverse covariance matrix.
 
@@ -1747,7 +1747,7 @@
 
        would calculate the pair-wise distances between the vectors in
        X using the Python function sokalsneath. This would result in
-       sokalsneath being called :math:`${n \choose 2}$` times, which
+       sokalsneath being called :math:`{n \choose 2}` times, which
        is inefficient. Instead, the optimized C version is more
        efficient, and we call it using the following syntax.::
 
@@ -1755,11 +1755,11 @@
 
     :Parameters:
        XA : ndarray
-           An :math:`$m_A$` by :math:`$n$` array of :math:`$m_A$`
-           original observations in an :math:`$n$`-dimensional space.
+           An :math:`m_A` by :math:`n` array of :math:`m_A`
+           original observations in an :math:`n`-dimensional space.
        XB : ndarray
-           An :math:`$m_B$` by :math:`$n$` array of :math:`$m_B$`
-           original observations in an :math:`$n$`-dimensional space.
+           An :math:`m_B` by :math:`n` array of :math:`m_B`
+           original observations in an :math:`n`-dimensional space.
        metric : string or function
            The distance metric to use. The distance function can
            be 'braycurtis', 'canberra', 'chebyshev', 'cityblock',
@@ -1780,7 +1780,7 @@
 
     :Returns:
        Y : ndarray
-           A :math:`$m_A$` by :math:`$m_B$` distance matrix.
+           A :math:`m_A` by :math:`m_B` distance matrix.
        """
 
 



More information about the Scipy-svn mailing list