prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  BUG: `geocentroid` coordiantes should divide distance
  <!--
  Thanks for contributing a pull request!
  
  Please follow these standard acronyms to start the commit message:
  
  - ENH: enhancement
  - BUG: bug fix
  - DOC: documentation
  - TYP: type annotations
  - TST: addition or modification of tests
  - MAINT: maintenance commit (refactoring, typos, etc.)
  - BLD: change related to building
  - REL: related to releasing
  - API: an (incompatible) API change
  - DEP: deprecate something, or remove a deprecated object
  - DEV: development tool or utility
  - REV: revert an earlier commit
  - PERF: performance improvement
  - BOT: always commit via a bot
  - CI: related to CI or CD
  - CLN: Code cleanup
  -->
  
  - [x] closes #832
  - [x] whatsnew entry
  
  ```latex
          \left\{\begin{matrix}
              d_i &=& D(P(\bar{x}_n, \bar{y}_n), P(x_i,y_i))  \\
              \bar{x}_0 &=& \frac{\sum w_i x_i}{\sum w_i} \\
              \bar{y}_0 &=& \frac{\sum w_i y_i}{\sum w_i} \\
              \bar{x}_{n+1} &=& \frac{\sum w_i x_i / d_i}{\sum w_i / d_i} \\
              \bar{y}_{n+1} &=& \frac{\sum w_i y_i / d_i}{\sum w_i / d_i} \\
          \end{matrix}\right.
  ```
  
  </issue>
  <code>
  [start of dtoolkit/geoaccessor/geoseries/geocentroid.py]
  1 import geopandas as gpd
  2 import numpy as np
  3 import pandas as pd
  4 from shapely import Point
  5 
  6 from dtoolkit.geoaccessor.geoseries.geodistance import geodistance
  7 from dtoolkit.geoaccessor.geoseries.xy import xy
  8 from dtoolkit.geoaccessor.register import register_geoseries_method
  9 
  10 
  11 @register_geoseries_method
  12 def geocentroid(
  13     s: gpd.GeoSeries,
  14     /,
  15     weights: pd.Series = None,
  16     max_iter: int = 300,
  17     tol: float = 1e-5,
  18 ) -> Point:
  19     r"""
  20     Return the centroid of all points via the center of gravity method.
  21 
  22     .. math::
  23 
  24         \left\{\begin{matrix}
  25             d_i &=& D(P(\bar{x}_n, \bar{y}_n), P(x_i, y_i))  \\
  26             \bar{x}_0 &=& \frac{\sum w_i x_i}{\sum w_i} \\
  27             \bar{y}_0 &=& \frac{\sum w_i y_i}{\sum w_i} \\
  28             \bar{x}_{n+1} &=& \frac{\sum w_i x_i / d_i}{\sum w_i / d_i} \\
  29             \bar{y}_{n+1} &=& \frac{\sum w_i y_i / d_i}{\sum w_i / d_i} \\
  30         \end{matrix}\right.
  31 
  32     Parameters
  33     ----------
  34     weights : Hashable or 1d array-like, optional
  35         - None : All weights will be set to 1.
  36         - Hashable : Only for DataFrame, the column name.
  37         - 1d array-like : The weights of each point.
  38 
  39     max_iter : int, default 300
  40         Maximum number of iterations to perform.
  41 
  42     tol : float, default 1e-5
  43         Tolerance for convergence.
  44 
  45     Returns
  46     -------
  47     Point
  48 
  49     See Also
  50     --------
  51     geopandas.GeoSeries.centroid
  52     dtoolkit.geoaccessor.geoseries.geocentroid
  53     dtoolkit.geoaccessor.geodataframe.geocentroid
  54 
  55     Examples
  56     --------
  57     >>> import dtoolkit.geoaccessor
  58     >>> import geopandas as gpd
  59     >>> from shapely import Point
  60     >>> df = gpd.GeoDataFrame(
  61     ...     {
  62     ...         "weights": [1, 2, 3],
  63     ...         "geometry": [Point(100, 32), Point(120, 50), Point(122, 55)],
  64     ...     },
  65     ...     crs=4326,
  66     ... )
  67     >>> df
  68        weights                    geometry
  69     0        1  POINT (100.00000 32.00000)
  70     1        2  POINT (120.00000 50.00000)
  71     2        3  POINT (122.00000 55.00000)
  72     >>> df.geocentroid()
  73     <POINT (120 50)>
  74 
  75     Set weights for each point.
  76 
  77     >>> df.geocentroid("weights")
  78     <POINT (121.999 54.998)>
  79     >>> df.geocentroid([1, 2, 3])
  80     <POINT (121.999 54.998)>
  81     """
  82 
  83     weights = np.asarray(weights) if weights is not None else 1
  84     coord = xy(s)
  85     X = coord.mean()
  86     for _ in range(max_iter):
  87         dis = geodistance(s, Point(*X.tolist())).rdiv(1).mul(weights, axis=0)
  88         Xt = coord.mul(dis, axis=0).sum() / dis.sum()
  89 
  90         if ((X - Xt).abs() <= tol).all():
  91             X = Xt
  92             break
  93 
  94         X = Xt
  95 
  96     return Point(*X.tolist())
  97
  [end of dtoolkit/geoaccessor/geoseries/geocentroid.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/dtoolkit/geoaccessor/geoseries/geocentroid.py b/dtoolkit/geoaccessor/geoseries/geocentroid.py
  --- a/dtoolkit/geoaccessor/geoseries/geocentroid.py
  +++ b/dtoolkit/geoaccessor/geoseries/geocentroid.py
  @@ -75,14 +75,14 @@
       Set weights for each point.
   
       >>> df.geocentroid("weights")
  -    <POINT (121.999 54.998)>
  +    <POINT (121.999 54.999)>
       >>> df.geocentroid([1, 2, 3])
  -    <POINT (121.999 54.998)>
  +    <POINT (121.999 54.999)>
       """
   
       weights = np.asarray(weights) if weights is not None else 1
       coord = xy(s)
  -    X = coord.mean()
  +    X = coord.mul(weights, axis=0).mean()
       for _ in range(max_iter):
           dis = geodistance(s, Point(*X.tolist())).rdiv(1).mul(weights, axis=0)
           Xt = coord.mul(dis, axis=0).sum() / dis.sum()
  
verification_info: {"golden_diff": "diff --git a/dtoolkit/geoaccessor/geoseries/geocentroid.py b/dtoolkit/geoaccessor/geoseries/geocentroid.py\n--- a/dtoolkit/geoaccessor/geoseries/geocentroid.py\n+++ b/dtoolkit/geoaccessor/geoseries/geocentroid.py\n@@ -75,14 +75,14 @@\n     Set weights for each point.\n \n     >>> df.geocentroid(\"weights\")\n-    <POINT (121.999 54.998)>\n+    <POINT (121.999 54.999)>\n     >>> df.geocentroid([1, 2, 3])\n-    <POINT (121.999 54.998)>\n+    <POINT (121.999 54.999)>\n     \"\"\"\n \n     weights = np.asarray(weights) if weights is not None else 1\n     coord = xy(s)\n-    X = coord.mean()\n+    X = coord.mul(weights, axis=0).mean()\n     for _ in range(max_iter):\n         dis = geodistance(s, Point(*X.tolist())).rdiv(1).mul(weights, axis=0)\n         Xt = coord.mul(dis, axis=0).sum() / dis.sum()\n", "issue": "BUG: `geocentroid` coordiantes should divide distance\n<!--\r\nThanks for contributing a pull request!\r\n\r\nPlease follow these standard acronyms to start the commit message:\r\n\r\n- ENH: enhancement\r\n- BUG: bug fix\r\n- DOC: documentation\r\n- TYP: type annotations\r\n- TST: addition or modification of tests\r\n- MAINT: maintenance commit (refactoring, typos, etc.)\r\n- BLD: change related to building\r\n- REL: related to releasing\r\n- API: an (incompatible) API change\r\n- DEP: deprecate something, or remove a deprecated object\r\n- DEV: development tool or utility\r\n- REV: revert an earlier commit\r\n- PERF: performance improvement\r\n- BOT: always commit via a bot\r\n- CI: related to CI or CD\r\n- CLN: Code cleanup\r\n-->\r\n\r\n- [x] closes #832\r\n- [x] whatsnew entry\r\n\r\n```latex\r\n        \\left\\{\\begin{matrix}\r\n            d_i &=& D(P(\\bar{x}_n, \\bar{y}_n), P(x_i,y_i))  \\\\\r\n            \\bar{x}_0 &=& \\frac{\\sum w_i x_i}{\\sum w_i} \\\\\r\n            \\bar{y}_0 &=& \\frac{\\sum w_i y_i}{\\sum w_i} \\\\\r\n            \\bar{x}_{n+1} &=& \\frac{\\sum w_i x_i / d_i}{\\sum w_i / d_i} \\\\\r\n            \\bar{y}_{n+1} &=& \\frac{\\sum w_i y_i / d_i}{\\sum w_i / d_i} \\\\\r\n        \\end{matrix}\\right.\r\n```\n", "before_files": [{"content": "import geopandas as gpd\nimport numpy as np\nimport pandas as pd\nfrom shapely import Point\n\nfrom dtoolkit.geoaccessor.geoseries.geodistance import geodistance\nfrom dtoolkit.geoaccessor.geoseries.xy import xy\nfrom dtoolkit.geoaccessor.register import register_geoseries_method\n\n\n@register_geoseries_method\ndef geocentroid(\n    s: gpd.GeoSeries,\n    /,\n    weights: pd.Series = None,\n    max_iter: int = 300,\n    tol: float = 1e-5,\n) -> Point:\n    r\"\"\"\n    Return the centroid of all points via the center of gravity method.\n\n    .. math::\n\n        \\left\\{\\begin{matrix}\n            d_i &=& D(P(\\bar{x}_n, \\bar{y}_n), P(x_i, y_i))  \\\\\n            \\bar{x}_0 &=& \\frac{\\sum w_i x_i}{\\sum w_i} \\\\\n            \\bar{y}_0 &=& \\frac{\\sum w_i y_i}{\\sum w_i} \\\\\n            \\bar{x}_{n+1} &=& \\frac{\\sum w_i x_i / d_i}{\\sum w_i / d_i} \\\\\n            \\bar{y}_{n+1} &=& \\frac{\\sum w_i y_i / d_i}{\\sum w_i / d_i} \\\\\n        \\end{matrix}\\right.\n\n    Parameters\n    ----------\n    weights : Hashable or 1d array-like, optional\n        - None : All weights will be set to 1.\n        - Hashable : Only for DataFrame, the column name.\n        - 1d array-like : The weights of each point.\n\n    max_iter : int, default 300\n        Maximum number of iterations to perform.\n\n    tol : float, default 1e-5\n        Tolerance for convergence.\n\n    Returns\n    -------\n    Point\n\n    See Also\n    --------\n    geopandas.GeoSeries.centroid\n    dtoolkit.geoaccessor.geoseries.geocentroid\n    dtoolkit.geoaccessor.geodataframe.geocentroid\n\n    Examples\n    --------\n    >>> import dtoolkit.geoaccessor\n    >>> import geopandas as gpd\n    >>> from shapely import Point\n    >>> df = gpd.GeoDataFrame(\n    ...     {\n    ...         \"weights\": [1, 2, 3],\n    ...         \"geometry\": [Point(100, 32), Point(120, 50), Point(122, 55)],\n    ...     },\n    ...     crs=4326,\n    ... )\n    >>> df\n       weights                    geometry\n    0        1  POINT (100.00000 32.00000)\n    1        2  POINT (120.00000 50.00000)\n    2        3  POINT (122.00000 55.00000)\n    >>> df.geocentroid()\n    <POINT (120 50)>\n\n    Set weights for each point.\n\n    >>> df.geocentroid(\"weights\")\n    <POINT (121.999 54.998)>\n    >>> df.geocentroid([1, 2, 3])\n    <POINT (121.999 54.998)>\n    \"\"\"\n\n    weights = np.asarray(weights) if weights is not None else 1\n    coord = xy(s)\n    X = coord.mean()\n    for _ in range(max_iter):\n        dis = geodistance(s, Point(*X.tolist())).rdiv(1).mul(weights, axis=0)\n        Xt = coord.mul(dis, axis=0).sum() / dis.sum()\n\n        if ((X - Xt).abs() <= tol).all():\n            X = Xt\n            break\n\n        X = Xt\n\n    return Point(*X.tolist())\n", "path": "dtoolkit/geoaccessor/geoseries/geocentroid.py"}]}