parameters: (c)
return_statement: return mat
docstring: Return the scaled companion matrix of c.
  
      The basis polynomials are scaled so that the companion matrix is
      symmetric when `c` is an HermiteE basis polynomial. This provides
      better eigenvalue estimates than the unscaled case and for basis
      polynomials the eigenvalues are guaranteed to be real if
      `numpy.linalg.eigvalsh` is used to obtain them.
  
      Parameters
      ----------
      c : array_like
          1-D array of HermiteE series coefficients ordered from low to high
          degree.
  
      Returns
      -------
      mat : ndarray
          Scaled companion matrix of dimensions (deg, deg).
  
      Notes
      -----
  
      .. versionadded:: 1.7.0
docstring_summary: Return the scaled companion matrix of c.
docstring_tokens: Return the scaled companion matrix of c .
function: def hermecompanion(c):
      """
      Return the scaled companion matrix of c.
  
      The basis polynomials are scaled so that the companion matrix is
      symmetric when `c` is an HermiteE basis polynomial. This provides
      better eigenvalue estimates than the unscaled case and for basis
      polynomials the eigenvalues are guaranteed to be real if
      `numpy.linalg.eigvalsh` is used to obtain them.
  
      Parameters
      ----------
      c : array_like
          1-D array of HermiteE series coefficients ordered from low to high
          degree.
  
      Returns
      -------
      mat : ndarray
          Scaled companion matrix of dimensions (deg, deg).
  
      Notes
      -----
  
      .. versionadded:: 1.7.0
  
      """
      # c is a trimmed copy
      [c] = pu.as_series([c])
      if len(c) < 2:
          raise ValueError('Series must have maximum degree of at least 1.')
      if len(c) == 2:
          return np.array([[-c[0]/c[1]]])
  
      n = len(c) - 1
      mat = np.zeros((n, n), dtype=c.dtype)
      scl = np.hstack((1., 1./np.sqrt(np.arange(n - 1, 0, -1))))
      scl = np.multiply.accumulate(scl)[::-1]
      top = mat.reshape(-1)[1::n+1]
      bot = mat.reshape(-1)[n::n+1]
      top[...] = np.sqrt(np.arange(1, n))
      bot[...] = top
      mat[:, -1] -= scl*c[:-1]/c[-1]
      return mat
function_tokens: def hermecompanion ( c ) : # c is a trimmed copy [ c ] = pu . as_series ( [ c ] ) if len ( c ) < 2 : raise ValueError ( 'Series must have maximum degree of at least 1.' ) if len ( c ) == 2 : return np . array ( [ [ - c [ 0 ] / c [ 1 ] ] ] ) n = len ( c ) - 1 mat = np . zeros ( ( n , n ) , dtype = c . dtype ) scl = np . hstack ( ( 1. , 1. / np . sqrt ( np . arange ( n - 1 , 0 , - 1 ) ) ) ) scl = np . multiply . accumulate ( scl ) [ : : - 1 ] top = mat . reshape ( - 1 ) [ 1 : : n + 1 ] bot = mat . reshape ( - 1 ) [ n : : n + 1 ] top [ ... ] = np . sqrt ( np . arange ( 1 , n ) ) bot [ ... ] = top mat [ : , - 1 ] -= scl * c [ : - 1 ] / c [ - 1 ] return mat