code: def ss2tf(A, B, C, D, input=0):
      r"""State-space to transfer function.
  
      A, B, C, D defines a linear state-space system with `p` inputs,
      `q` outputs, and `n` state variables.
  
      Parameters
      ----------
      A : array_like
          State (or system) matrix of shape ``(n, n)``
      B : array_like
          Input matrix of shape ``(n, p)``
      C : array_like
          Output matrix of shape ``(q, n)``
      D : array_like
          Feedthrough (or feedforward) matrix of shape ``(q, p)``
      input : int, optional
          For multiple-input systems, the index of the input to use.
  
      Returns
      -------
      num : 2-D ndarray
          Numerator(s) of the resulting transfer function(s).  `num` has one row
          for each of the system's outputs. Each row is a sequence representation
          of the numerator polynomial.
      den : 1-D ndarray
          Denominator of the resulting transfer function(s).  `den` is a sequence
          representation of the denominator polynomial.
  
      Examples
      --------
      Convert the state-space representation:
  
      .. math::
  
          \dot{\textbf{x}}(t) =
          \begin{bmatrix} -2 & -1 \\ 1 & 0 \end{bmatrix} \textbf{x}(t) +
          \begin{bmatrix} 1 \\ 0 \end{bmatrix} \textbf{u}(t) \\
  
          \textbf{y}(t) = \begin{bmatrix} 1 & 2 \end{bmatrix} \textbf{x}(t) +
          \begin{bmatrix} 1 \end{bmatrix} \textbf{u}(t)
  
      >>> A = [[-2, -1], [1, 0]]
      >>> B = [[1], [0]]  # 2-dimensional column vector
      >>> C = [[1, 2]]    # 2-dimensional row vector
      >>> D = 1
  
      to the transfer function:
  
      .. math:: H(s) = \frac{s^2 + 3s + 3}{s^2 + 2s + 1}
  
      >>> from scipy.signal import ss2tf
      >>> ss2tf(A, B, C, D)
      (array([[1, 3, 3]]), array([ 1.,  2.,  1.]))
      """
      # transfer function is C (sI - A)**(-1) B + D
  
      # Check consistency and make them all rank-2 arrays
      A, B, C, D = abcd_normalize(A, B, C, D)
  
      nout, nin = D.shape
      if input >= nin:
          raise ValueError("System does not have the input specified.")
  
      # make SIMO from possibly MIMO system.
      B = B[:, input : input + 1]
      D = D[:, input : input + 1]
  
      try:
          den = poly(A)
      except ValueError:
          den = 1
  
      if (product(B.shape, axis=0) == 0) and (
          product(C.shape, axis=0) == 0
      ):
          num = numpy.ravel(D)
          if (product(D.shape, axis=0) == 0) and (
              product(A.shape, axis=0) == 0
          ):
              den = []
          return num, den
  
      num_states = A.shape[0]
      type_test = A[:, 0] + B[:, 0] + C[0, :] + D
      num = numpy.zeros((nout, num_states + 1), type_test.dtype)
      for k in range(nout):
          Ck = atleast_2d(C[k, :])
          num[k] = poly(A - dot(B, Ck)) + (D[k] - 1) * den
  
      return num, den
  
file_path: catboost/contrib/python/scipy/py2/scipy/signal/lti_conversion.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import numpy
  from numpy import r_, eye, atleast_2d, poly, dot, asarray, product, zeros, array, outer
  from scipy import linalg
  from .filter_design import tf2zpk, zpk2tf, normalize
label_desc: Use image node_id 8 for calling a global function with example usage: ss2tf(A, B, C, D, input) and returns: num,  den, num,  den