prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Deprecation warning for asmatrix
  The usage of numpy asmatrix raises Deprecation Warnings in numpy 1.15.4:
  PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
  There are 5 occurences in pandapower/pf/dSbus_dV_pypower.py.
  
  </issue>
  <code>
  [start of pandapower/pf/dSbus_dV_pypower.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 # Copyright 1996-2015 PSERC. All rights reserved.
  4 # Use of this source code is governed by a BSD-style
  5 # license that can be found in the LICENSE file.
  6 
  7 # Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics
  8 # and Energy System Technology (IEE), Kassel. All rights reserved.
  9 
  10 
  11 
  12 """Computes partial derivatives of power injection w.r.t. voltage.
  13 """
  14 
  15 from numpy import conj, diag, asmatrix, asarray, zeros
  16 from scipy.sparse import issparse, csr_matrix as sparse
  17 
  18 
  19 def dSbus_dV(Ybus, V):
  20     """Computes partial derivatives of power injection w.r.t. voltage.
  21     """
  22 
  23     if issparse(Ybus):
  24         return dSbus_dV_sparse(Ybus, V)
  25     else:
  26         return dSbus_dV_dense(Ybus, V)
  27 
  28 
  29 def dSbus_dV_sparse(Ybus, V):
  30     Ibus = Ybus * V
  31     ib = range(len(V))
  32     diagV = sparse((V, (ib, ib)))
  33     diagIbus = sparse((Ibus, (ib, ib)))
  34     diagVnorm = sparse((V / abs(V), (ib, ib)))
  35     dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm
  36     dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)
  37     return dS_dVm, dS_dVa
  38 
  39 
  40 def dSbus_dV_dense(Ybus, V):
  41     # standard code from Pypower (slower than above)
  42     Ibus = Ybus * asmatrix(V).T
  43 
  44     diagV = asmatrix(diag(V))
  45     diagIbus = asmatrix(diag(asarray(Ibus).flatten()))
  46     diagVnorm = asmatrix(diag(V / abs(V)))
  47 
  48     dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm
  49     dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)
  50     return dS_dVm, dS_dVa
  51
  [end of pandapower/pf/dSbus_dV_pypower.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/pandapower/pf/dSbus_dV_pypower.py b/pandapower/pf/dSbus_dV_pypower.py
  --- a/pandapower/pf/dSbus_dV_pypower.py
  +++ b/pandapower/pf/dSbus_dV_pypower.py
  @@ -12,7 +12,7 @@
   """Computes partial derivatives of power injection w.r.t. voltage.
   """
   
  -from numpy import conj, diag, asmatrix, asarray, zeros
  +from numpy import conj, diag, asarray
   from scipy.sparse import issparse, csr_matrix as sparse
   
   
  @@ -39,11 +39,11 @@
   
   def dSbus_dV_dense(Ybus, V):
       # standard code from Pypower (slower than above)
  -    Ibus = Ybus * asmatrix(V).T
  +    Ibus = Ybus * asarray(V).T
   
  -    diagV = asmatrix(diag(V))
  -    diagIbus = asmatrix(diag(asarray(Ibus).flatten()))
  -    diagVnorm = asmatrix(diag(V / abs(V)))
  +    diagV = asarray(diag(V))
  +    diagIbus = asarray(diag(asarray(Ibus).flatten()))
  +    diagVnorm = asarray(diag(V / abs(V)))
   
       dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm
       dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)
  
verification_info: {"golden_diff": "diff --git a/pandapower/pf/dSbus_dV_pypower.py b/pandapower/pf/dSbus_dV_pypower.py\n--- a/pandapower/pf/dSbus_dV_pypower.py\n+++ b/pandapower/pf/dSbus_dV_pypower.py\n@@ -12,7 +12,7 @@\n \"\"\"Computes partial derivatives of power injection w.r.t. voltage.\n \"\"\"\n \n-from numpy import conj, diag, asmatrix, asarray, zeros\n+from numpy import conj, diag, asarray\n from scipy.sparse import issparse, csr_matrix as sparse\n \n \n@@ -39,11 +39,11 @@\n \n def dSbus_dV_dense(Ybus, V):\n     # standard code from Pypower (slower than above)\n-    Ibus = Ybus * asmatrix(V).T\n+    Ibus = Ybus * asarray(V).T\n \n-    diagV = asmatrix(diag(V))\n-    diagIbus = asmatrix(diag(asarray(Ibus).flatten()))\n-    diagVnorm = asmatrix(diag(V / abs(V)))\n+    diagV = asarray(diag(V))\n+    diagIbus = asarray(diag(asarray(Ibus).flatten()))\n+    diagVnorm = asarray(diag(V / abs(V)))\n \n     dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm\n     dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)\n", "issue": "Deprecation warning for asmatrix\nThe usage of numpy asmatrix raises Deprecation Warnings in numpy 1.15.4:\r\nPendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.\r\nThere are 5 occurences in pandapower/pf/dSbus_dV_pypower.py.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright 1996-2015 PSERC. All rights reserved.\n# Use of this source code is governed by a BSD-style\n# license that can be found in the LICENSE file.\n\n# Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics\n# and Energy System Technology (IEE), Kassel. All rights reserved.\n\n\n\n\"\"\"Computes partial derivatives of power injection w.r.t. voltage.\n\"\"\"\n\nfrom numpy import conj, diag, asmatrix, asarray, zeros\nfrom scipy.sparse import issparse, csr_matrix as sparse\n\n\ndef dSbus_dV(Ybus, V):\n    \"\"\"Computes partial derivatives of power injection w.r.t. voltage.\n    \"\"\"\n\n    if issparse(Ybus):\n        return dSbus_dV_sparse(Ybus, V)\n    else:\n        return dSbus_dV_dense(Ybus, V)\n\n\ndef dSbus_dV_sparse(Ybus, V):\n    Ibus = Ybus * V\n    ib = range(len(V))\n    diagV = sparse((V, (ib, ib)))\n    diagIbus = sparse((Ibus, (ib, ib)))\n    diagVnorm = sparse((V / abs(V), (ib, ib)))\n    dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm\n    dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)\n    return dS_dVm, dS_dVa\n\n\ndef dSbus_dV_dense(Ybus, V):\n    # standard code from Pypower (slower than above)\n    Ibus = Ybus * asmatrix(V).T\n\n    diagV = asmatrix(diag(V))\n    diagIbus = asmatrix(diag(asarray(Ibus).flatten()))\n    diagVnorm = asmatrix(diag(V / abs(V)))\n\n    dS_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm\n    dS_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV)\n    return dS_dVm, dS_dVa\n", "path": "pandapower/pf/dSbus_dV_pypower.py"}]}