code: def dSbus_dV(self, Y, V):
          
          ib = range(len(V))
  
          I = Y * V
  
          diagV = csr_matrix((V, (ib, ib)))
          diagIbus = csr_matrix((I, (ib, ib)))
          # Element-wise division.
          diagVnorm = csr_matrix((V / abs(V), (ib, ib)))
  
          dS_dVm = diagV * conj(Y * diagVnorm) + conj(diagIbus) * diagVnorm
          dS_dVa = 1j * diagV * conj(diagIbus - Y * diagV)
  
          return dS_dVm, dS_dVa
docs: Based on dSbus_dV.m from MATPOWER by Ray Zimmerman, developed at
          PSERC Cornell. See U{http://www.pserc.cornell.edu/matpower/} for more
          information.
  
          @return: The partial derivatives of power injection w.r.t. voltage
                   magnitude and voltage angle.
          @rtype: tuple