ó
Ë½÷Xc        	   @   s¢  d  Z  d d l m Z i d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6Z i d d 6d d 6d d 6d d
 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d  6d! d" 6d# d$ 6Z d% „  Z d& Z i
 d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d  6d! d" 6d# d$ 6Z d' „  Z d( „  Z	 d) Z
 d* „  Z d+ Z d, „  Z d- Z d. „  Z d/ Z d0 „  Z d1 Z d2 „  Z d3 Z d4 Z d5 „  Z d6 Z d7 „  Z d8 Z d9 „  Z d: Z i	 d; d< 6d= d> 6d? d@ 6d; dA 6d; d 6d; dB 6d; dC 6d; dD 6d; dE 6Z dF „  Z dG „  Z dH „  Z dI „  Z dJ Z  dK „  Z! dL Z" dM „  Z# dN Z$ dO Z% dP Z& dQ Z' dR „  Z( dS „  Z) dT „  Z* dU dV dW dX dY dZ d[ d\ d] „ Z+ e, d^ k rže+ ƒ  n  d_ S(`   sù   
Code generator script to make the Cython BLAS and LAPACK wrappers
from the files "cython_blas_signatures.txt" and
"cython_lapack_signatures.txt" which contain the signatures for
all the BLAS/LAPACK routines that should be included in the wrappers.
iÿÿÿÿ(   t
   itemgettert   integert   intt   complext   cs   double precisiont   dt   realt   ss
   complex*16t   zt	   charactert   chart   logicalt   bintt   npy_complex64t   doublet   floatt   npy_complex128t	   _cselect1t   cselect1t	   _cselect2t   cselect2t	   _dselect2t   dselect2t	   _dselect3t   dselect3t	   _sselect2t   sselect2t	   _sselect3t   sselect3t	   _zselect1t   zselect1t	   _zselect2t   zselect2c         C   s/   t  g  |  j d ƒ D] } | j d ƒ ^ q Œ  S(   Ns   , s    *(   t   zipt   split(   t   argst   arg(    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   arg_names_and_types#   s    sô   
cdef extern from "{header_name}":
    void _fortran_{name} "F_FUNC({name}wrp, {upname}WRP)"({ret_type} *out, {fort_args}) nogil
cdef {ret_type} {name}({args}) nogil:
    cdef {ret_type} out
    _fortran_{name}(&out, {argnames})
    return out
c         C   s   |  d k r d j  |  ƒ Sd S(   NR   R   R   R   R   R   R   R   R   R   s   <{0}*>t    (
   R   R   R   R   R   R   R   R   R   R   (   t   format(   R$   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt	   arg_casts6   s
     	c   
      C   sÁ  t  | ƒ \ } } | | k r¿ g  | D]" } | | k r= | n | d ^ q% } g  | D]" } | d k rl | n | d ^ qT } d j g  t | | ƒ D]! \ } } d j | | g ƒ ^ q’ ƒ } n  g  | D] } t j | | ƒ ^ qÆ } d j g  t | | ƒ D]! \ } } d j | | g ƒ ^ qú ƒ } g  t | | ƒ D] \ } } t | ƒ | ^ q4} d j | ƒ } t | }	 | j d d ƒ } t j	 d |  d |  j
 ƒ  d	 | d
 | d | d |	 d | d | ƒ S(   Nt   _t   lambdat   ins   , s    *t   lambda_t   namet   upnameR#   t	   fort_argst   ret_typet
   c_ret_typet   argnamest   header_name(   s   lambdas   in(   R%   t   joinR!   t	   npy_typest   getR(   t   c_typest   replacet   pyx_func_templateR'   t   upper(
   R-   R0   R#   R3   t   argtypesR2   t   nt   tR/   R1   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   pyx_decl_func>   s$    /,	:%	72
!s¨   cdef extern from "{header_name}":
    void _fortran_{name} "F_FUNC({name},{upname})"({fort_args}) nogil
cdef void {name}({args}) nogil:
    _fortran_{name}({argnames})
c         C   s9  t  | ƒ \ } } g  | D] } t j | | ƒ ^ q } g  | D]" } | d k rV | n | d ^ q> } d j g  t | | ƒ D]! \ } } d j | | g ƒ ^ q| ƒ } g  t | | ƒ D] \ } } t | ƒ | ^ q¶ } d j | ƒ } | j d d ƒ j d d	 ƒ } t j d
 |  d |  j	 ƒ  d | d | d | d | ƒ S(   NR*   R+   R)   s   , s    *s   *lambda,s	   *lambda_,s   *in,s   *in_,R-   R.   R#   R/   R2   R3   (   s   lambdas   in(
   R%   R5   R6   R4   R!   R(   R8   t   pyx_sub_templateR'   R:   (   R-   R#   R3   R;   R2   R=   R<   R/   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   pyx_decl_sub]   s    %/	72s†  # cython: boundscheck = False
# cython: wraparound = False
# cython: cdivision = True

"""
BLAS Functions for Cython
=========================

Usable from Cython via::

    cimport scipy.linalg.cython_blas

These wrappers do not check for alignment of arrays.
Alignment should be checked before these wrappers are used.

Raw function pointers (Fortran-style pointer arguments):

- {}


"""

# Within scipy, these wrappers can be used via relative or absolute cimport.
# Examples:
# from ..linalg cimport cython_blas
# from scipy.linalg cimport cython_blas
# cimport scipy.linalg.cython_blas as cython_blas
# cimport ..linalg.cython_blas as cython_blas

# Within scipy, if BLAS functions are needed in C/C++/Fortran,
# these wrappers should not be used.
# The original libraries should be linked directly.

cdef extern from "fortran_defs.h":
    pass

from numpy cimport npy_complex64, npy_complex128

c         C   s3   g  |  D] } | d ^ q } t  j d j | ƒ ƒ S(   Ni    s   
- (   t   blas_pyx_preambleR'   R4   (   t   all_sigst   sigt   names(    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   make_blas_pyx_preamble“   s    s"  """
LAPACK functions for Cython
===========================

Usable from Cython via::

    cimport scipy.linalg.cython_lapack

This module provides Cython-level wrappers for all primary routines included
in LAPACK 3.1.0 except for ``zcgesv`` since its interface is not consistent
from LAPACK 3.1.0 to 3.6.0. It also provides some of the
fixed-api auxiliary routines.

These wrappers do not check for alignment of arrays.
Alignment should be checked before these wrappers are used.

Raw function pointers (Fortran-style pointer arguments):

- {}


"""

# Within scipy, these wrappers can be used via relative or absolute cimport.
# Examples:
# from ..linalg cimport cython_lapack
# from scipy.linalg cimport cython_lapack
# cimport scipy.linalg.cython_lapack as cython_lapack
# cimport ..linalg.cython_lapack as cython_lapack

# Within scipy, if LAPACK functions are needed in C/C++/Fortran,
# these wrappers should not be used.
# The original libraries should be linked directly.

cdef extern from "fortran_defs.h":
    pass

from numpy cimport npy_complex64, npy_complex128

cdef extern from "_lapack_subroutines.h":
    # Function pointer type declarations for
    # gees and gges families of functions.
    ctypedef bint _cselect1(npy_complex64*)
    ctypedef bint _cselect2(npy_complex64*, npy_complex64*)
    ctypedef bint _dselect2(d*, d*)
    ctypedef bint _dselect3(d*, d*, d*)
    ctypedef bint _sselect2(s*, s*)
    ctypedef bint _sselect3(s*, s*, s*)
    ctypedef bint _zselect1(npy_complex128*)
    ctypedef bint _zselect2(npy_complex128*, npy_complex128*)

c         C   s3   g  |  D] } | d ^ q } t  j d j | ƒ ƒ S(   Ni    s   
- (   t   lapack_pyx_preambleR'   R4   (   RB   RC   RD   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   make_lapack_pyx_preambleÍ   s    sæ  

# Python-accessible wrappers for testing:

cdef inline bint _is_contiguous(double[:,:] a, int axis) nogil:
    return (a.strides[axis] == sizeof(a[0,0]) or a.shape[axis] == 1)

cpdef float complex _test_cdotc(float complex[:] cx, float complex[:] cy) nogil:
    cdef:
        int n = cx.shape[0]
        int incx = cx.strides[0] // sizeof(cx[0])
        int incy = cy.strides[0] // sizeof(cy[0])
    return cdotc(&n, &cx[0], &incx, &cy[0], &incy)

cpdef float complex _test_cdotu(float complex[:] cx, float complex[:] cy) nogil:
    cdef:
        int n = cx.shape[0]
        int incx = cx.strides[0] // sizeof(cx[0])
        int incy = cy.strides[0] // sizeof(cy[0])
    return cdotu(&n, &cx[0], &incx, &cy[0], &incy)

cpdef double _test_dasum(double[:] dx) nogil:
    cdef:
        int n = dx.shape[0]
        int incx = dx.strides[0] // sizeof(dx[0])
    return dasum(&n, &dx[0], &incx)

cpdef double _test_ddot(double[:] dx, double[:] dy) nogil:
    cdef:
        int n = dx.shape[0]
        int incx = dx.strides[0] // sizeof(dx[0])
        int incy = dy.strides[0] // sizeof(dy[0])
    return ddot(&n, &dx[0], &incx, &dy[0], &incy)

cpdef int _test_dgemm(double alpha, double[:,:] a, double[:,:] b, double beta,
                double[:,:] c) nogil except -1:
    cdef:
        char *transa
        char *transb
        int m, n, k, lda, ldb, ldc
        double *a0=&a[0,0]
        double *b0=&b[0,0]
        double *c0=&c[0,0]
    # In the case that c is C contiguous, swap a and b and
    # swap whether or not each of them is transposed.
    # This can be done because a.dot(b) = b.T.dot(a.T).T.
    if _is_contiguous(c, 1):
        if _is_contiguous(a, 1):
            transb = 'n'
            ldb = (&a[1,0]) - a0 if a.shape[0] > 1 else 1
        elif _is_contiguous(a, 0):
            transb = 't'
            ldb = (&a[0,1]) - a0 if a.shape[1] > 1 else 1
        else:
            with gil:
                raise ValueError("Input 'a' is neither C nor Fortran contiguous.")
        if _is_contiguous(b, 1):
            transa = 'n'
            lda = (&b[1,0]) - b0 if b.shape[0] > 1 else 1
        elif _is_contiguous(b, 0):
            transa = 't'
            lda = (&b[0,1]) - b0 if b.shape[1] > 1 else 1
        else:
            with gil:
                raise ValueError("Input 'b' is neither C nor Fortran contiguous.")
        k = b.shape[0]
        if k != a.shape[1]:
            with gil:
                raise ValueError("Shape mismatch in input arrays.")
        m = b.shape[1]
        n = a.shape[0]
        if n != c.shape[0] or m != c.shape[1]:
            with gil:
                raise ValueError("Output array does not have the correct shape.")
        ldc = (&c[1,0]) - c0 if c.shape[0] > 1 else 1
        dgemm(transa, transb, &m, &n, &k, &alpha, b0, &lda, a0,
                   &ldb, &beta, c0, &ldc)
    elif _is_contiguous(c, 0):
        if _is_contiguous(a, 1):
            transa = 't'
            lda = (&a[1,0]) - a0 if a.shape[0] > 1 else 1
        elif _is_contiguous(a, 0):
            transa = 'n'
            lda = (&a[0,1]) - a0 if a.shape[1] > 1 else 1
        else:
            with gil:
                raise ValueError("Input 'a' is neither C nor Fortran contiguous.")
        if _is_contiguous(b, 1):
            transb = 't'
            ldb = (&b[1,0]) - b0 if b.shape[0] > 1 else 1
        elif _is_contiguous(b, 0):
            transb = 'n'
            ldb = (&b[0,1]) - b0 if b.shape[1] > 1 else 1
        else:
            with gil:
                raise ValueError("Input 'b' is neither C nor Fortran contiguous.")
        m = a.shape[0]
        k = a.shape[1]
        if k != b.shape[0]:
            with gil:
                raise ValueError("Shape mismatch in input arrays.")
        n = b.shape[1]
        if m != c.shape[0] or n != c.shape[1]:
            with gil:
                raise ValueError("Output array does not have the correct shape.")
        ldc = (&c[0,1]) - c0 if c.shape[1] > 1 else 1
        dgemm(transa, transb, &m, &n, &k, &alpha, a0, &lda, b0,
                   &ldb, &beta, c0, &ldc)
    else:
        with gil:
            raise ValueError("Input 'c' is neither C nor Fortran contiguous.")
    return 0

cpdef double _test_dnrm2(double[:] x) nogil:
    cdef:
        int n = x.shape[0]
        int incx = x.strides[0] // sizeof(x[0])
    return dnrm2(&n, &x[0], &incx)

cpdef double _test_dzasum(double complex[:] zx) nogil:
    cdef:
        int n = zx.shape[0]
        int incx = zx.strides[0] // sizeof(zx[0])
    return dzasum(&n, &zx[0], &incx)

cpdef double _test_dznrm2(double complex[:] x) nogil:
    cdef:
        int n = x.shape[0]
        int incx = x.strides[0] // sizeof(x[0])
    return dznrm2(&n, &x[0], &incx)

cpdef int _test_icamax(float complex[:] cx) nogil:
    cdef:
        int n = cx.shape[0]
        int incx = cx.strides[0] // sizeof(cx[0])
    return icamax(&n, &cx[0], &incx)

cpdef int _test_idamax(double[:] dx) nogil:
    cdef:
        int n = dx.shape[0]
        int incx = dx.strides[0] // sizeof(dx[0])
    return idamax(&n, &dx[0], &incx)

cpdef int _test_isamax(float[:] sx) nogil:
    cdef:
        int n = sx.shape[0]
        int incx = sx.strides[0] // sizeof(sx[0])
    return isamax(&n, &sx[0], &incx)

cpdef int _test_izamax(double complex[:] zx) nogil:
    cdef:
        int n = zx.shape[0]
        int incx = zx.strides[0] // sizeof(zx[0])
    return izamax(&n, &zx[0], &incx)

cpdef float _test_sasum(float[:] sx) nogil:
    cdef:
        int n = sx.shape[0]
        int incx = sx.shape[0] // sizeof(sx[0])
    return sasum(&n, &sx[0], &incx)

cpdef float _test_scasum(float complex[:] cx) nogil:
    cdef:
        int n = cx.shape[0]
        int incx = cx.strides[0] // sizeof(cx[0])
    return scasum(&n, &cx[0], &incx)

cpdef float _test_scnrm2(float complex[:] x) nogil:
    cdef:
        int n = x.shape[0]
        int incx = x.strides[0] // sizeof(x[0])
    return scnrm2(&n, &x[0], &incx)

cpdef float _test_sdot(float[:] sx, float[:] sy) nogil:
    cdef:
        int n = sx.shape[0]
        int incx = sx.strides[0] // sizeof(sx[0])
        int incy = sy.strides[0] // sizeof(sy[0])
    return sdot(&n, &sx[0], &incx, &sy[0], &incy)

cpdef float _test_snrm2(float[:] x) nogil:
    cdef:
        int n = x.shape[0]
        int incx = x.shape[0] // sizeof(x[0])
    return snrm2(&n, &x[0], &incx)

cpdef double complex _test_zdotc(double complex[:] zx, double complex[:] zy) nogil:
    cdef:
        int n = zx.shape[0]
        int incx = zx.strides[0] // sizeof(zx[0])
        int incy = zy.strides[0] // sizeof(zy[0])
    return zdotc(&n, &zx[0], &incx, &zy[0], &incy)

cpdef double complex _test_zdotu(double complex[:] zx, double complex[:] zy) nogil:
    cdef:
        int n = zx.shape[0]
        int incx = zx.strides[0] // sizeof(zx[0])
        int incy = zy.strides[0] // sizeof(zy[0])
    return zdotu(&n, &zx[0], &incx, &zy[0], &incy)
c            sX   d j  ‡  f d †  |  Dƒ ƒ } d d j  ‡  f d †  | Dƒ ƒ } t | ƒ | | t S(   Ns   
c         3   s"   |  ] } t  | ˆ  f Œ  Vq d  S(   N(   R>   (   t   .0R   (   R3   (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>œ  s    c         3   s/   |  ]% } t  | d  d  d … ˆ  f Œ  Vq d  S(   Ni   (   R@   (   RH   R   (   R3   (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>  s   (   R4   RE   t   blas_py_wrappers(   t	   func_sigst   sub_sigsRB   R3   t   funcst   subs(    (   R3   sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_blas_pyx›  s    sž  

# Python accessible wrappers for testing:

def _test_dlamch(cmach):
    # This conversion is necessary to handle Python 3 strings.
    cmach_bytes = bytes(cmach)
    # Now that it is a bytes representation, a non-temporary variable
    # must be passed as a part of the function call.
    cdef char* cmach_char = cmach_bytes
    return dlamch(cmach_char)

def _test_slamch(cmach):
    # This conversion is necessary to handle Python 3 strings.
    cmach_bytes = bytes(cmach)
    # Now that it is a bytes representation, a non-temporary variable
    # must be passed as a part of the function call.
    cdef char* cmach_char = cmach_bytes
    return slamch(cmach_char)
c            s^   d j  ‡  f d †  |  Dƒ ƒ } d d j  ‡  f d †  | Dƒ ƒ } t | ƒ } | | | t S(   Ns   
c         3   s"   |  ] } t  | ˆ  f Œ  Vq d  S(   N(   R>   (   RH   R   (   R3   (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>¸  s    c         3   s/   |  ]% } t  | d  d  d … ˆ  f Œ  Vq d  S(   Ni   (   R@   (   RH   R   (   R3   (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>¹  s   (   R4   RG   t   lapack_py_wrappers(   RJ   RK   RB   R3   RL   RM   t   preamble(    (   R3   sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_lapack_pyx·  s
    sC   ctypedef {ret_type} {name}_t({args}) nogil
cdef {name}_t *{name}_f
s%   cdef {ret_type} {name}({args}) nogil
c         C   s:   | j  d d ƒ j  d d ƒ } t j d |  d | d | ƒ S(   NR*   R,   s   *in,s   *in_,R-   R0   R#   (   R8   t   pxd_templateR'   (   R-   R0   R#   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   pxd_declÅ  s    sö  # Within scipy, these wrappers can be used via relative or absolute cimport.
# Examples:
# from ..linalg cimport cython_blas
# from scipy.linalg cimport cython_blas
# cimport scipy.linalg.cython_blas as cython_blas
# cimport ..linalg.cython_blas as cython_blas

# Within scipy, if BLAS functions are needed in C/C++/Fortran,
# these wrappers should not be used.
# The original libraries should be linked directly.

ctypedef float s
ctypedef double d
ctypedef float complex c
ctypedef double complex z

c         C   s!   d j  d „  |  Dƒ ƒ } t | S(   Ns   
c         s   s   |  ] } t  | Œ  Vq d  S(   N(   RS   (   RH   RC   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>Ý  s    (   R4   t   blas_pxd_preamble(   RB   t   body(    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_blas_pxdÜ  s    sM  # Within scipy, these wrappers can be used via relative or absolute cimport.
# Examples:
# from ..linalg cimport cython_lapack
# from scipy.linalg cimport cython_lapack
# cimport scipy.linalg.cython_lapack as cython_lapack
# cimport ..linalg.cython_lapack as cython_lapack

# Within scipy, if LAPACK functions are needed in C/C++/Fortran,
# these wrappers should not be used.
# The original libraries should be linked directly.

ctypedef float s
ctypedef double d
ctypedef float complex c
ctypedef double complex z

# Function pointer type declarations for
# gees and gges families of functions.
ctypedef bint cselect1(c*)
ctypedef bint cselect2(c*, c*)
ctypedef bint dselect2(d*, d*)
ctypedef bint dselect3(d*, d*, d*)
ctypedef bint sselect2(s*, s*)
ctypedef bint sselect3(s*, s*, s*)
ctypedef bint zselect1(z*)
ctypedef bint zselect2(z*, z*)

c         C   s   t  d j d „  |  Dƒ ƒ S(   Ns   
c         s   s   |  ] } t  | Œ  Vq d  S(   N(   RS   (   RH   RC   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>ÿ  s    (   t   lapack_pxd_preambleR4   (   RB   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_lapack_pxdþ  s    s¼         subroutine {name}wrp(ret, {argnames})
        external {wrapper}
        {ret_type} {wrapper}
        {ret_type} ret
        {argdecls}
        ret = {wrapper}({argnames})
      end
s   (*)t   works   (ldab,*)t   abs   (lda,*)t   at   dlt   dut   apt   et   lldc         C   sk   d |  k r |  Sd d d g } d |  k s7 d |  k rO | d | k rO |  d S|  t  k rg |  t  |  S|  S(	   Nt   inct   ladivt   lapy2t   lapy3t   xt   yi   s   (n)(   t   dims(   R-   t   funcnamet   xy_exclusions(    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   process_fortran_name  s    (c   	      C   sÀ   |  d d k s |  d k r) d |  } n |  } t  | ƒ \ } } d j | ƒ } g  | D] } t | |  ƒ ^ qW } d	 j d
 „  t | | ƒ Dƒ ƒ } t j d |  d | d | d | d t | ƒ S(   Ni    R   R   t   zladivt   zdotut   zdotct   ws   , s	   
        c         s   s+   |  ]! \ } } d  j  t | | ƒ Vq d S(   s   {0} {1}N(   R'   t   fortran_types(   RH   R<   R=   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>"  s   R-   t   wrapperR2   t   argdeclsR0   (   R   R   (   Rk   Rl   Rm   (   R%   R4   Rj   R!   t   fortran_templateR'   Ro   (	   R-   R0   R#   Rp   t   typesRD   R2   R<   Rq   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   fort_subroutine_wrapper  s    "c         C   s   d j  d „  |  Dƒ ƒ S(   Ns   
c         s   s   |  ] } t  | Œ  Vq d  S(   N(   Rt   (   RH   RC   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>*  s    (   R4   (   RJ   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_fortran)  s    c         C   sO   t  |  ƒ \ } } g  | D] } t | ^ q } d j d „  t | | ƒ Dƒ ƒ S(   Ns   , c         s   s'   |  ] \ } } d  j  | | ƒ Vq d S(   s   {0} *{1}N(   R'   (   RH   R=   R<   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>0  s    (   R%   R7   R4   R!   (   R#   Rs   RD   R$   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   make_c_args-  s    sA   void F_FUNC({name}wrp, {upname}WRP)({return_type} *ret, {args});
c      	   C   s>   t  | ƒ } t | } t j d |  d |  j ƒ  d | d | ƒ S(   NR-   R.   t   return_typeR#   (   Rv   R7   t   c_func_templateR'   R:   (   R-   Rw   R#   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   c_func_decl5  s    
s&   void F_FUNC({name},{upname})({args});
c         C   s.   t  | ƒ } t j d |  d |  j ƒ  d | ƒ S(   NR-   R.   R#   (   Rv   t   c_sub_templateR'   R:   (   R-   Rw   R#   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt
   c_sub_decl>  s    s•   #ifndef SCIPY_LINALG_{lib}_FORTRAN_WRAPPERS_H
#define SCIPY_LINALG_{lib}_FORTRAN_WRAPPERS_H
#include "fortran_defs.h"
#include "numpy/arrayobject.h"
s‰  
typedef int (*_cselect1)(npy_complex64*);
typedef int (*_cselect2)(npy_complex64*, npy_complex64*);
typedef int (*_dselect2)(double*, double*);
typedef int (*_dselect3)(double*, double*, double*);
typedef int (*_sselect2)(float*, float*);
typedef int (*_sselect3)(float*, float*, float*);
typedef int (*_zselect1)(npy_complex128*);
typedef int (*_zselect2)(npy_complex128*, npy_complex128*);
s)   
#ifdef __cplusplus
extern "C" {
#endif

s$   
#ifdef __cplusplus
}
#endif
#endif
c         C   s‰   d j  d „  |  Dƒ ƒ } d d j  d „  | Dƒ ƒ } | d k r[ t j d | ƒ t } n t j d | ƒ } d j  | t | | t g ƒ S(   NR&   c         s   s   |  ] } t  | Œ  Vq d  S(   N(   Ry   (   RH   RC   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>c  s    s   
c         s   s   |  ] } t  | Œ  Vq d  S(   N(   R{   (   RH   RC   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pys	   <genexpr>d  s    t   LAPACKt   lib(   R4   t
   c_preambleR'   t   lapack_declst	   cpp_guardt   c_end(   RJ   RK   RB   t   lib_nameRL   RM   RP   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   generate_c_headerb  s    c         C   s;   |  d  j  d ƒ \ } } | j  d ƒ \ } } | | | f S(   Niÿÿÿÿt   (t    (   R"   (   RC   t   name_and_typeR#   R0   R-   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   split_signaturel  s    c         C   sÚ   g  |  D]. } | d k r | d d k r | j  ƒ  ^ q }  g  |  D]+ } | j d ƒ d d k rB t | ƒ ^ qB } g  |  D]+ } | j d ƒ d d k rz t | ƒ ^ qz } t t | | d t d ƒ ƒƒ } | | | f S(   Ns   
i    t   #R…   t   voidt   key(   t   stripR"   R‡   t   listt   sortedR    (   t   lst   lRJ   RK   RB   (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   filter_linesr  s
    ;88"s   cython_blas_signatures.txts   cython_lapack_signatures.txtt   cython_blast   cython_lapacks   _blas_subroutine_wrappers.fs   _lapack_subroutine_wrappers.fs   _blas_subroutines.hs   _lapack_subroutines.hc         C   s  d d g } d j  g  | D] }	 d |	 ^ q ƒ d }
 d j  g  | D] }	 d |	 ^ qC ƒ d } d j  g  | D] }	 d |	 ^ qm ƒ d } t |  d ƒ  } | j ƒ  } Wd  QXt | ƒ } t | | f Œ  } t | d	 d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt | d ƒ } t | d d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt | d ƒ } t | d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt | d Œ  } t | d
 ƒ ! } | j |
 ƒ | j | ƒ Wd  QXt | d ƒ  } | j ƒ  } Wd  QXt | ƒ } t	 | | f Œ  } t | d	 d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt
 | d ƒ } t | d d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt | d ƒ } t | d
 ƒ ! } | j | ƒ | j | ƒ Wd  QXt | d Œ  } t | d
 ƒ ! } | j |
 ƒ | j | ƒ Wd  QXd  S(   Ns:   This file was generated by _cython_wrapper_generators.py.
s    Do not edit this file directly.
R&   s   // s   
s   # s   c     t   rs   .pyxRn   i   s   .pxdi    t   BLASR|   (   R”   (   s   LAPACK(   R4   t   opent	   readlinesR   RN   t   writeRV   Ru   Rƒ   RQ   RX   (   t   blas_signature_filet   lapack_signature_filet	   blas_namet   lapack_namet   blas_fortran_namet   lapack_fortran_namet   blas_header_namet   lapack_header_namet   commentst   linet   ccommentt
   pyxcommentt   fcommentt   ft	   blas_sigst   blas_pyxt   blas_pxdt   blas_fortrant   blas_c_headert   lapack_sigst
   lapack_pyxt
   lapack_pxdt   lapack_fortrant   lapack_c_header(    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   make_allz  sV    	***t   __main__N(-   t   __doc__t   operatorR    Ro   R7   R%   R9   R5   R(   R>   R?   R@   RA   RE   RF   RG   RI   RN   RO   RQ   RR   RS   RT   RV   RW   RX   Rr   Rg   Rj   Rt   Ru   Rv   Rx   Ry   Rz   R{   R~   R   R€   R   Rƒ   R‡   R   R°   t   __name__(    (    (    sF   /tmp/pip-build-7oUkmx/scipy/scipy/linalg/_cython_wrapper_generators.pyt   <module>   sš   



	
			3	7	Ë						
&							
		-