ó
Ë½÷Xc        
   @` sÍ  d  d l  m Z m Z m Z d d d d d d d g Z d  d	 l Z d  d
 l m Z m Z m Z m	 Z	 m
 Z
 m Z m Z m Z d  d l m Z d  d l m Z d d l m Z m Z m Z d d l m Z m Z e d d ƒ Z d „  Z d „  Z d „  Z d	 e e e e e e d „ Z  d	 e e e e e d	 d e d „	 Z! e e e d d	 d  e d „ Z" d	 e e e d „ Z# d	 e e e e d	 d e d „ Z$ e e d d	 e d „ Z% d d d g Z& e e e d „ Z' d	 S(    i    (   t   divisiont   print_functiont   absolute_importt   eigt   eight
   eig_bandedt   eigvalst   eigvalsht   eigvals_bandedt
   hessenbergN(   t   arrayt   isfinitet   inexactt   nonzerot   iscomplexobjt   castt   flatnonzerot   conj(   t   xrange(   t   _asarray_validatedi   (   t   LinAlgErrort   _datacopiedt   norm(   t   get_lapack_funcst   _compute_lworkt   Fy              ð?c         C` sº   t  j | d | ƒ} |  j d k } | d c  |  j d d k  O*xr t | ƒ D]d } | d d … | d f | j d d … | f <t | d d … | f | d d … | d f ƒ qN W| S(   sR   
    Produce complex-valued eigenvectors from LAPACK DGGEV real-valued output
    t   dtypei    iÿÿÿÿi   N(   t   numpyR
   t   imagR   R   (   t   wt   vinR   t   vt   mt   i(    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyt   _make_complex_eigvecs!   s    -5c         C` sû   | rD | d  k r. t j |  t j |  ƒ f ƒ St j |  | f ƒ Sn³ | d  k rT |  St j |  ƒ } |  d k } | d k } | } |  | | | | | <t j | | | @<t j |  j d k ƒ rÖ t j | | | @<n t	 t j t j ƒ | | | @<| Sd  S(   Ni    (
   t   NoneR   t   vstackt	   ones_liket
   empty_liket   inft   allR   t   nant   complex(   t   alphat   betat   homogeneous_eigvalsR   t
   alpha_zerot	   beta_zerot   beta_nonzero(    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyt   _make_eigvals/   s     c      	   C` s€  t  d
 |  | f ƒ \ } | | } }	 | |  | d d ƒ}
 |
 d d j j t j ƒ } | j d k r« | |  | | |	 | | | ƒ \ } } } } } } t | | | ƒ } nS | |  | | |	 | | | ƒ \ } } } } } } } | t | } t | | | ƒ } | d k  rt d | ƒ ‚ n  | d k r=t	 d | ƒ ‚ n  t j
 | j d	 k ƒ } | j d k pg| s¯| j j } | r‘t | | | ƒ } n  | r¯t | | | ƒ } q¯n  x‘ t | j d ƒ D]| } | r| d  d  … | f c t | d  d  … | f ƒ <n  | rÃ| d  d  … | f c t | d  d  … | f ƒ <qÃqÃW| pL| sS| S| rv| rl| | | f S| | f S| | f S(   Nt   ggevt   lworkiÿÿÿÿiþÿÿÿi    t   czs0   illegal value in %d-th argument of internal ggevs4   generalized eig algorithm did not converge (info=%d)g        (   s   ggev(   R   t   realt   astypeR   t   intt   typecodeR1   t   _It
   ValueErrorR   R(   R   R   t   charR"   R   t   shapeR   (   t   a1t   b1t   leftt   rightt   overwrite_at   overwrite_bR-   R2   t   cvlt   cvrt   resR3   R+   R,   t   vlt   vrt   workt   infoR   t   alphart   alphait	   only_realt   tR!   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyt   _geneigI   sL    59
c         C` s  t  |  d | ƒ} t | j ƒ d k sA | j d | j d k rP t d ƒ ‚ n  | pb t | |  ƒ } | d k	 rt  | d | ƒ}	 | p• t |	 | ƒ } t |	 j ƒ d k sÇ |	 j d |	 j d k rÖ t d ƒ ‚ n  |	 j | j k r÷ t d ƒ ‚ n  t | |	 | | | | | ƒ St d | f ƒ \ }
 } | | } } t | | j d d	 | d
 | ƒ} |
 j	 d k r®|
 | d | d	 | d
 | d | ƒ\ } } } } t
 | d | ƒ } nq |
 | d | d	 | d
 | d | ƒ\ } } } } } i d d 6d d 6| j j } | t | } t
 | d | ƒ } | d k  r?t d | ƒ ‚ n  | d k r^t d | ƒ ‚ n  t j | j d k ƒ } |
 j	 d k pˆ| sÐ| j j } | r²t | | | ƒ } n  | rÐt | | | ƒ } qÐn  | pÙ| sà| S| r| rù| | | f S| | f S| | f S(   s 	  
    Solve an ordinary or generalized eigenvalue problem of a square matrix.

    Find eigenvalues w and right or left eigenvectors of a general matrix::

        a   vr[:,i] = w[i]        b   vr[:,i]
        a.H vl[:,i] = w[i].conj() b.H vl[:,i]

    where ``.H`` is the Hermitian conjugation.

    Parameters
    ----------
    a : (M, M) array_like
        A complex or real matrix whose eigenvalues and eigenvectors
        will be computed.
    b : (M, M) array_like, optional
        Right-hand side matrix in a generalized eigenvalue problem.
        Default is None, identity matrix is assumed.
    left : bool, optional
        Whether to calculate and return left eigenvectors.  Default is False.
    right : bool, optional
        Whether to calculate and return right eigenvectors.  Default is True.
    overwrite_a : bool, optional
        Whether to overwrite `a`; may improve performance.  Default is False.
    overwrite_b : bool, optional
        Whether to overwrite `b`; may improve performance.  Default is False.
    check_finite : bool, optional
        Whether to check that the input matrices contain only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.
    homogeneous_eigvals : bool, optional
        If True, return the eigenvalues in homogeneous coordinates.
        In this case ``w`` is a (2, M) array so that::

            w[1,i] a vr[:,i] = w[0,i] b vr[:,i]

        Default is False.

    Returns
    -------
    w : (M,) or (2, M) double or complex ndarray
        The eigenvalues, each repeated according to its
        multiplicity. The shape is (M,) unless
        ``homogeneous_eigvals=True``.
    vl : (M, M) double or complex ndarray
        The normalized left eigenvector corresponding to the eigenvalue
        ``w[i]`` is the column vl[:,i]. Only returned if ``left=True``.
    vr : (M, M) double or complex ndarray
        The normalized right eigenvector corresponding to the eigenvalue
        ``w[i]`` is the column ``vr[:,i]``.  Only returned if ``right=True``.

    Raises
    ------
    LinAlgError
        If eigenvalue computation does not converge.

    See Also
    --------
    eigh : Eigenvalues and right eigenvectors for symmetric/Hermitian arrays.

    t   check_finitei   i    i   s   expected square matrixs    a and b must have the same shapet   geevt
   geev_lworkt
   compute_vlt
   compute_vrR4   R3   RA   R   t   ft   Dt   ds0   illegal value in %d-th argument of internal geevsQ   eig algorithm did not converge (only eigenvalues with order >= %d have converged)g        N(   s   geevs
   geev_lwork(   R   t   lenR<   R:   R   R#   RN   R   R   R8   R1   R   R;   R9   R   R   R(   R   R"   (   t   at   bR?   R@   RA   RB   RO   R-   R=   R>   RP   RQ   RR   RS   R3   R   RF   RG   RI   t   wrt   wiRM   RL   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   w   sf    ?//	
c
         C` s  t  |  d |	 ƒ}
 t |
 j ƒ d k sA |
 j d |
 j d k rP t d ƒ ‚ n  | pb t |
 |  ƒ } t |
 ƒ rz t } n t } | d! k	 rRt  | d |	 ƒ} | p° t | | ƒ } t | j ƒ d k sâ | j d | j d k rñ t d ƒ ‚ n  | j |
 j k r.t d t	 | j ƒ t	 |
 j ƒ f ƒ ‚ n  t | ƒ rCt } qX| pLt } n d! } | rdd pgd } | d! k	 rè| \ } } | d k  s¡| |
 j d k rÅt d	 d |
 j d d f ƒ ‚ n  | d 7} | d 7} | | f } n  | r÷d
 } n d } | rd } n d } | d! k ræt
 | d f |
 f ƒ \ } | d! k r‰| |
 d | d | d d d d d |
 j d d | ƒ\ } } } q-| \ } } | |
 d | d | d d d | d | d | ƒ\ } } } | d | | d !} nG| d! k	 rzt
 | d f |
 | f ƒ \ } | \ } } | |
 | d | d | d | d | d | d | d | ƒ\ } } } } | d | | d !} n³ | rØt
 | d f |
 | f ƒ \ } | |
 | d | d | d | d | d | ƒ\ } } } nU t
 | d f |
 | f ƒ \ } | |
 | d | d | d | d | d | ƒ\ } } } | d k rP| rC| S| | f SnÁ | d k  rpt d | ƒ ‚ n¡ | d k r—| d! k r—t d ƒ ‚ nz d | k  oµ| j d k n rö| d! k	 rãt d t | ƒ d ƒ ‚ qt d | ƒ ‚ n t d  | | j d ƒ ‚ d! S("   sÌ  
    Solve an ordinary or generalized eigenvalue problem for a complex
    Hermitian or real symmetric matrix.

    Find eigenvalues w and optionally eigenvectors v of matrix `a`, where
    `b` is positive definite::

                      a v[:,i] = w[i] b v[:,i]
        v[i,:].conj() a v[:,i] = w[i]
        v[i,:].conj() b v[:,i] = 1

    Parameters
    ----------
    a : (M, M) array_like
        A complex Hermitian or real symmetric matrix whose eigenvalues and
        eigenvectors will be computed.
    b : (M, M) array_like, optional
        A complex Hermitian or real symmetric definite positive matrix in.
        If omitted, identity matrix is assumed.
    lower : bool, optional
        Whether the pertinent array data is taken from the lower or upper
        triangle of `a`. (Default: lower)
    eigvals_only : bool, optional
        Whether to calculate only eigenvalues and no eigenvectors.
        (Default: both are calculated)
    turbo : bool, optional
        Use divide and conquer algorithm (faster but expensive in memory,
        only for generalized eigenvalue problem and if eigvals=None)
    eigvals : tuple (lo, hi), optional
        Indexes of the smallest and largest (in ascending order) eigenvalues
        and corresponding eigenvectors to be returned: 0 <= lo <= hi <= M-1.
        If omitted, all eigenvalues and eigenvectors are returned.
    type : int, optional
        Specifies the problem type to be solved:

           type = 1: a   v[:,i] = w[i] b v[:,i]

           type = 2: a b v[:,i] = w[i]   v[:,i]

           type = 3: b a v[:,i] = w[i]   v[:,i]
    overwrite_a : bool, optional
        Whether to overwrite data in `a` (may improve performance)
    overwrite_b : bool, optional
        Whether to overwrite data in `b` (may improve performance)
    check_finite : bool, optional
        Whether to check that the input matrices contain only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    w : (N,) float ndarray
        The N (1<=N<=M) selected eigenvalues, in ascending order, each
        repeated according to its multiplicity.
    v : (M, N) complex ndarray
        (if eigvals_only == False)

        The normalized selected eigenvector corresponding to the
        eigenvalue w[i] is the column v[:,i].

        Normalization:

            type 1 and 3: v.conj() a      v  = w

            type 2: inv(v).conj() a  inv(v) = w

            type = 1 or 2: v.conj() b      v  = I

            type = 3: v.conj() inv(b) v  = I

    Raises
    ------
    LinAlgError
        If eigenvalue computation does not converge,
        an error occurred, or b matrix is not definite positive. Note that
        if input matrices are not symmetric or hermitian, no error is reported
        but results will be wrong.

    See Also
    --------
    eig : eigenvalues and right eigenvectors for non-symmetric arrays

    RO   i   i    i   s   expected square matrixs#   wrong b dimensions %s, should be %st   Nt   VsC   The eigenvalue range specified is not valid.
Valid range is [%s,%s]t   Lt   Ut   het   syt   evrt   uplot   jobzt   ranget   At   ilt   iuRA   t   It   gvxt   itypeRB   t   gvdt   gvs<   illegal value in %i-th argument of internal fortran routine.s   unrecoverable internal error.s'   the eigenvectors %s failed to converge.sƒ   internal fortran routine failed to converge: %i off-diagonal elements of an intermediate tridiagonal form did not converge to zero.s    the leading minor of order %i of 'b' is not positive definite. The factorization of 'b' could not be completed and no eigenvalues or eigenvectors were computed.N(   R   RW   R<   R:   R   R   t   Truet   FalseR#   t   strR   R   R   (   RX   RY   t   lowert   eigvals_onlyRA   RB   t   turboR   t   typeRO   R=   t   cplxR>   t   _jobt   lot   hiRc   t   pfxRb   R   R   RI   t   w_totRj   t   ifailRl   Rm   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   ñ   sš    V/	/%	

		!"#RX   c         C` sÙ  | s | r6 t  |  d | ƒ} | p0 t | |  ƒ } nI t |  ƒ } t | j j t ƒ ry t | ƒ j ƒ  ry t	 d ƒ ‚ n  d } t
 | j ƒ d k r£ t	 d ƒ ‚ n  | j ƒ  d$ k rÄ t	 d ƒ ‚ n  | j ƒ  d% k rL| j j d k rt d& | f ƒ \ }	 d }
 n t d' | f ƒ \ }	 d }
 |	 | d | d | d | ƒ\ } } } n  | j ƒ  d( k r„| j ƒ  d) k rñd } d d t | ƒ t | ƒ f \ } } } } t | | ƒ d k  sÑt | | ƒ | j d k ràt	 d ƒ ‚ n  | | d } nL d } t | ƒ t | ƒ d d f \ } } } } | d k r=|  j d } n  | rLd } n  | j j d k r‚t d* t d d d ƒf ƒ \ } n! t d+ t d d d ƒf ƒ \ } d | d ƒ } | j j d k rãt d, | f ƒ \ } d }
 n t d- | f ƒ \ } d }
 | | | | | d | d d | d | d | d | d | d  | ƒ\ } } } } } | |  } | s„| d! d! … d! | … f } q„n  | d k  rªt	 d" | |
 f ƒ ‚ n  | d k rÅt d# ƒ ‚ n  | rÏ| S| | f S(.   s
  
    Solve real symmetric or complex hermitian band matrix eigenvalue problem.

    Find eigenvalues w and optionally right eigenvectors v of a::

        a v[:,i] = w[i] v[:,i]
        v.H v    = identity

    The matrix a is stored in a_band either in lower diagonal or upper
    diagonal ordered form:

        a_band[u + i - j, j] == a[i,j]        (if upper form; i <= j)
        a_band[    i - j, j] == a[i,j]        (if lower form; i >= j)

    where u is the number of bands above the diagonal.

    Example of a_band (shape of a is (6,6), u=2)::

        upper form:
        *   *   a02 a13 a24 a35
        *   a01 a12 a23 a34 a45
        a00 a11 a22 a33 a44 a55

        lower form:
        a00 a11 a22 a33 a44 a55
        a10 a21 a32 a43 a54 *
        a20 a31 a42 a53 *   *

    Cells marked with * are not used.

    Parameters
    ----------
    a_band : (u+1, M) array_like
        The bands of the M by M matrix a.
    lower : bool, optional
        Is the matrix in the lower form. (Default is upper form)
    eigvals_only : bool, optional
        Compute only the eigenvalues and no eigenvectors.
        (Default: calculate also eigenvectors)
    overwrite_a_band : bool, optional
        Discard data in a_band (may enhance performance)
    select : {'a', 'v', 'i'}, optional
        Which eigenvalues to calculate

        ======  ========================================
        select  calculated
        ======  ========================================
        'a'     All eigenvalues
        'v'     Eigenvalues in the interval (min, max]
        'i'     Eigenvalues with indices min <= i <= max
        ======  ========================================
    select_range : (min, max), optional
        Range of selected eigenvalues
    max_ev : int, optional
        For select=='v', maximum number of eigenvalues expected.
        For other values of select, has no meaning.

        In doubt, leave this parameter untouched.

    check_finite : bool, optional
        Whether to check that the input matrix contains only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    w : (M,) ndarray
        The eigenvalues, in ascending order, each repeated according to its
        multiplicity.
    v : (M, M) float or complex ndarray
        The normalized eigenvector corresponding to the eigenvalue w[i] is
        the column v[:,i].

    Raises LinAlgError if eigenvalue computation does not converge

    RO   s#   array must not contain infs or NaNsi   i   s   expected two-dimensional arrayi    RX   R   R!   R(   t   valuet   indexs   invalid argument for selectt   GFDt   hbevdt   sbevdt	   compute_vRq   t   overwrite_abg        s   select_range out of boundst   fFt   lamchR   RT   RV   t   st   hbevxt   sbevxt   mmaxRe   t   abstolNs.   illegal value in %d-th argument of internal %ss   eig algorithm did not converge(	   i    i   i   RX   R   R!   s   alls   values   index(   i    RX   s   all(   R   (   R€   (   i   i   R!   R   s   indexs   value(   i   R!   s   index(   s   lamch(   s   lamch(   R†   (   R‡   (   R   R   R
   t
   issubclassR   Rt   R   R   R(   R:   RW   R<   Rq   R;   R   t   mint   maxR   (   t   a_bandRq   Rr   t   overwrite_a_bandt   selectt   select_ranget   max_evRO   R=   t   bevdt   internal_nameR   R   RI   RF   t   vuRg   Rh   R„   R‰   t   bevxR    R{   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   À  st    N(	*1*	$!	
"c         C` s.   t  |  d | d d d d d | d | d | ƒS(   so  
    Compute eigenvalues from an ordinary or generalized eigenvalue problem.

    Find eigenvalues of a general matrix::

        a   vr[:,i] = w[i]        b   vr[:,i]

    Parameters
    ----------
    a : (M, M) array_like
        A complex or real matrix whose eigenvalues and eigenvectors
        will be computed.
    b : (M, M) array_like, optional
        Right-hand side matrix in a generalized eigenvalue problem.
        If omitted, identity matrix is assumed.
    overwrite_a : bool, optional
        Whether to overwrite data in a (may improve performance)
    check_finite : bool, optional
        Whether to check that the input matrices contain only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities
        or NaNs.
    homogeneous_eigvals : bool, optional
        If True, return the eigenvalues in homogeneous coordinates.
        In this case ``w`` is a (2, M) array so that::

            w[1,i] a vr[:,i] = w[0,i] b vr[:,i]

        Default is False.

    Returns
    -------
    w : (M,) or (2, M) double or complex ndarray
        The eigenvalues, each repeated according to its multiplicity
        but not in any specific order. The shape is (M,) unless
        ``homogeneous_eigvals=True``.

    Raises
    ------
    LinAlgError
        If eigenvalue computation does not converge

    See Also
    --------
    eigvalsh : eigenvalues of symmetric or Hermitian arrays,
    eig : eigenvalues and right eigenvectors of general arrays.
    eigh : eigenvalues and eigenvectors of symmetric/Hermitian arrays.

    RY   R?   i    R@   RA   RO   R-   (   R   (   RX   RY   RA   RO   R-   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   ]  s    3!c	   	      C` s@   t  |  d | d | d t d | d | d | d | d | d	 | ƒ	S(
   s
  
    Solve an ordinary or generalized eigenvalue problem for a complex
    Hermitian or real symmetric matrix.

    Find eigenvalues w of matrix a, where b is positive definite::

                      a v[:,i] = w[i] b v[:,i]
        v[i,:].conj() a v[:,i] = w[i]
        v[i,:].conj() b v[:,i] = 1


    Parameters
    ----------
    a : (M, M) array_like
        A complex Hermitian or real symmetric matrix whose eigenvalues and
        eigenvectors will be computed.
    b : (M, M) array_like, optional
        A complex Hermitian or real symmetric definite positive matrix in.
        If omitted, identity matrix is assumed.
    lower : bool, optional
        Whether the pertinent array data is taken from the lower or upper
        triangle of `a`. (Default: lower)
    turbo : bool, optional
        Use divide and conquer algorithm (faster but expensive in memory,
        only for generalized eigenvalue problem and if eigvals=None)
    eigvals : tuple (lo, hi), optional
        Indexes of the smallest and largest (in ascending order) eigenvalues
        and corresponding eigenvectors to be returned: 0 <= lo < hi <= M-1.
        If omitted, all eigenvalues and eigenvectors are returned.
    type : int, optional
        Specifies the problem type to be solved:

           type = 1: a   v[:,i] = w[i] b v[:,i]

           type = 2: a b v[:,i] = w[i]   v[:,i]

           type = 3: b a v[:,i] = w[i]   v[:,i]
    overwrite_a : bool, optional
        Whether to overwrite data in `a` (may improve performance)
    overwrite_b : bool, optional
        Whether to overwrite data in `b` (may improve performance)
    check_finite : bool, optional
        Whether to check that the input matrices contain only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    w : (N,) float ndarray
        The N (1<=N<=M) selected eigenvalues, in ascending order, each
        repeated according to its multiplicity.

    Raises
    ------
    LinAlgError
        If eigenvalue computation does not converge,
        an error occurred, or b matrix is not definite positive. Note that
        if input matrices are not symmetric or hermitian, no error is reported
        but results will be wrong.

    See Also
    --------
    eigvals : eigenvalues of general arrays
    eigh : eigenvalues and right eigenvectors for symmetric/Hermitian arrays
    eig : eigenvalues and right eigenvectors for non-symmetric arrays

    RY   Rq   Rr   RA   RB   Rs   R   Rt   RO   (   R   Rn   (	   RX   RY   Rq   RA   RB   Rs   R   Rt   RO   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   •  s    Fc         C` s.   t  |  d | d d d | d | d | d | ƒS(   sI	  
    Solve real symmetric or complex hermitian band matrix eigenvalue problem.

    Find eigenvalues w of a::

        a v[:,i] = w[i] v[:,i]
        v.H v    = identity

    The matrix a is stored in a_band either in lower diagonal or upper
    diagonal ordered form:

        a_band[u + i - j, j] == a[i,j]        (if upper form; i <= j)
        a_band[    i - j, j] == a[i,j]        (if lower form; i >= j)

    where u is the number of bands above the diagonal.

    Example of a_band (shape of a is (6,6), u=2)::

        upper form:
        *   *   a02 a13 a24 a35
        *   a01 a12 a23 a34 a45
        a00 a11 a22 a33 a44 a55

        lower form:
        a00 a11 a22 a33 a44 a55
        a10 a21 a32 a43 a54 *
        a20 a31 a42 a53 *   *

    Cells marked with * are not used.

    Parameters
    ----------
    a_band : (u+1, M) array_like
        The bands of the M by M matrix a.
    lower : bool, optional
        Is the matrix in the lower form. (Default is upper form)
    overwrite_a_band : bool, optional
        Discard data in a_band (may enhance performance)
    select : {'a', 'v', 'i'}, optional
        Which eigenvalues to calculate

        ======  ========================================
        select  calculated
        ======  ========================================
        'a'     All eigenvalues
        'v'     Eigenvalues in the interval (min, max]
        'i'     Eigenvalues with indices min <= i <= max
        ======  ========================================
    select_range : (min, max), optional
        Range of selected eigenvalues
    check_finite : bool, optional
        Whether to check that the input matrix contains only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    w : (M,) ndarray
        The eigenvalues, in ascending order, each repeated according to its
        multiplicity.

    Raises LinAlgError if eigenvalue computation does not converge

    See Also
    --------
    eig_banded : eigenvalues and right eigenvectors for symmetric/Hermitian
        band matrices
    eigvals : eigenvalues of general arrays
    eigh : eigenvalues and right eigenvectors for symmetric/Hermitian arrays
    eig : eigenvalues and right eigenvectors for non-symmetric arrays

    Rq   Rr   i   RŽ   R   R   RO   (   R   (   R   Rq   RŽ   R   R   RO   (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR   á  s    JR!   t   lRV   c         C` s%  t  |  d | ƒ} t | j ƒ d k sA | j d | j d k rP t d ƒ ‚ n  | pb t | |  ƒ } | j d d k rœ | r˜ | t j | j d ƒ f S| St d | f ƒ \ } } } | | d	 d d
 | ƒ\ } }	 }
 } } | d k  rþ t d | ƒ ‚ n  t | ƒ } t | | j d d |	 d |
 ƒ} | | d |	 d |
 d | d
 d ƒ\ } } } | d k  ryt d | ƒ ‚ n  t j	 | d ƒ } | s•| St d | f ƒ \ } } t | | d |	 d |
 ƒ} | d | d | d |	 d |
 d | d
 d ƒ \ } } | d k  rt d | ƒ ‚ n  | | f S(   sú  
    Compute Hessenberg form of a matrix.

    The Hessenberg decomposition is::

        A = Q H Q^H

    where `Q` is unitary/orthogonal and `H` has only zero elements below
    the first sub-diagonal.

    Parameters
    ----------
    a : (M, M) array_like
        Matrix to bring into Hessenberg form.
    calc_q : bool, optional
        Whether to compute the transformation matrix.  Default is False.
    overwrite_a : bool, optional
        Whether to overwrite `a`; may improve performance.
        Default is False.
    check_finite : bool, optional
        Whether to check that the input matrix contains only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    H : (M, M) ndarray
        Hessenberg form of `a`.
    Q : (M, M) ndarray
        Unitary/orthogonal similarity transformation matrix ``A = Q H Q^H``.
        Only returned if ``calc_q=True``.

    RO   i   i    i   s   expected square matrixt   gehrdt   gebalt   gehrd_lworkt   permuteRA   s>   illegal value in %d-th argument of internal gebal (hessenberg)Rw   Rx   R3   s>   illegal value in %d-th argument of internal gehrd (hessenberg)iÿÿÿÿt   orghrt   orghr_lworkRX   t   taus>   illegal value in %d-th argument of internal orghr (hessenberg)(   s   gehrds   gebals   gehrd_lwork(   s   orghrs   orghr_lwork(
   R   RW   R<   R:   R   R   t   eyeR   R   t   triu(   RX   t   calc_qRA   RO   R=   R—   R˜   R™   t   baRw   Rx   t   pivscaleRI   t   nR3   t   hqR   t   hR›   Rœ   t   q(    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyR	   2  s<    "/'"-3((   t
   __future__R    R   R   t   __all__R   R
   R   R   R   R   R   R   R   t   scipy._lib.sixR   t   scipy._lib._utilR   t   miscR   R   R   t   lapackR   R   R9   R"   R1   RN   R#   Ro   Rn   R   R   R   R   R   R   t   _double_precisionR	   (    (    (    s2   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/decomp.pyt   <module>   s8   :			.yÍ	œ	7	JM