/* File: blasmodule.c */
/* This file is generated with a Python program f2py.py (version: 1.16 ).
 * f2py.py is a Fortran to Python Interface Generator (FPIG)
 * written by Pearu Peterson <pearu@ioc.ee>.
 * Generation date: Fri Jul 16 17:46:48 1999
 * $Revision:$
 * $Date:$
 */
#include "Python.h"
#include "arrayobject.h"
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif
 
typedef struct {float r,i;} complex_float;
typedef struct {double r,i;} complex_double;
typedef struct {long double r,i;} complex_long_double;

static PyObject *blas_error;

static int check_array_type(PyObject *op, int typecode, char type, int argnum) {
    char tempstr[80];
    PyArrayObject *arr;

    arr = (PyArrayObject *)op;
    if (arr->descr->type_num != typecode) {
         sprintf(tempstr,"Argument %d should have type '%c' but it has type '%c'.",argnum,type,arr->descr->type);
         PyErr_SetString(PyExc_TypeError,tempstr);
         return 0;
    }
    if (!(arr->flags & CONTIGUOUS)) {
         sprintf(tempstr,"Argument %d is not contiguous.");
         PyErr_SetString(PyExc_TypeError,tempstr);
         return 0;
    }
    
    return 1;
}

static int check_array_shape(PyObject *op, int num_dims, int dims_to_check, int array_argnum, ... ) {
    char      tempstr[120];
    char      str1[] = "s";
    char      str2[] = "";
    char      *str;
    int       k, check_dim, *size, list_num;
    PyArrayObject *arr;
    va_list   ap;
    
    arr = (PyArrayObject *)op;
    if (arr->nd != num_dims) {
       if (arr->nd == 1)
           str = str2;
       else
           str = str1;
       sprintf(tempstr,"Argument #%d has %d dimension%s but the routine expects it to have %d.",array_argnum,arr->nd,str,num_dims);
           
       PyErr_SetString(PyExc_TypeError,tempstr);
       return 0;
    }

    va_start (ap, array_argnum);
    for (k=0; k < dims_to_check; k++) {
        check_dim = va_arg(ap,int);  /* 1 is last dim, 2 is next-to-last, etc.*/
        size = va_arg(ap,int *);     /* expecting pointer to number */
        list_num = va_arg(ap,int);   /* The argument number of this argument */
        if (arr->dimensions[num_dims-check_dim] != *size) {
            sprintf(tempstr,"Dimension %d of argument #%d has size %d but it should have size %d\n\t according to argument #%d.", -check_dim, array_argnum, arr->dimensions[num_dims-check_dim], *size, list_num);
            PyErr_SetString(PyExc_TypeError,tempstr);
            va_end(ap);
            return 0;
        }
    }

    va_end(ap);
    return 1;         /* good return */
}

/*********************************** caxpy ***********************************/
static char doc_blas_caxpy[] = "None = _caxpy(int(n),complex(ca),array(cx,'F'),int(incx),array(cy,'F'),int(incy))";
void F_FUNC(caxpy,CAXPY)();
static PyObject *blas_caxpy(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyComplexObject	 *ca=NULL;
	complex_float	 ca_tmp;
	PyObject	 *cx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *cy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!:blas._caxpy",&PyInt_Type,&n,&PyComplex_Type,&ca,&PyArray_Type,&cx,&PyInt_Type,&incx,&PyArray_Type,&cy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(cx,PyArray_CFLOAT,'F',3)) return NULL;
	if (!check_array_type(cy,PyArray_CFLOAT,'F',5)) return NULL;
	F_FUNC(caxpy,CAXPY)(&(n->ob_ival),&(ca_tmp.r=ca->cval.real,ca_tmp.i=ca->cval.imag,ca_tmp),((complex_float*)(((PyArrayObject *)cx)->data)),&(incx->ob_ival),((complex_float*)(((PyArrayObject *)cy)->data)),&(incy->ob_ival));
	ca->cval.real=ca_tmp.r;ca->cval.imag=ca_tmp.i;
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** cdotc ***********************************/
static char doc_blas_cdotc[] = "complex() = _cdotc(int(n),array(cx,'F'),int(incx),array(cy,'F'),int(incy))";
complex_float F_FUNC(cdotc,CDOTC)();
static PyObject *blas_cdotc(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *cx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *cy=NULL;
	PyIntObject	 *incy=NULL;
	complex_float	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._cdotc",&PyInt_Type,&n,&PyArray_Type,&cx,&PyInt_Type,&incx,&PyArray_Type,&cy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(cx,PyArray_CFLOAT,'F',2)) return NULL;
	if (!check_array_type(cy,PyArray_CFLOAT,'F',4)) return NULL;
	return_value = F_FUNC(cdotc,CDOTC)(&(n->ob_ival),((complex_float*)(((PyArrayObject *)cx)->data)),&(incx->ob_ival),((complex_float*)(((PyArrayObject *)cy)->data)),&(incy->ob_ival));return PyComplex_FromDoubles(return_value.r,return_value.i);
}
/*********************************** cdotu ***********************************/
static char doc_blas_cdotu[] = "complex() = _cdotu(int(n),array(cx,'F'),int(incx),array(cy,'F'),int(incy))";
complex_float F_FUNC(cdotu,CDOTU)();
static PyObject *blas_cdotu(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *cx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *cy=NULL;
	PyIntObject	 *incy=NULL;
	complex_float	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._cdotu",&PyInt_Type,&n,&PyArray_Type,&cx,&PyInt_Type,&incx,&PyArray_Type,&cy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(cx,PyArray_CFLOAT,'F',2)) return NULL;
	if (!check_array_type(cy,PyArray_CFLOAT,'F',4)) return NULL;
	return_value = F_FUNC(cdotu,CDOTU)(&(n->ob_ival),((complex_float*)(((PyArrayObject *)cx)->data)),&(incx->ob_ival),((complex_float*)(((PyArrayObject *)cy)->data)),&(incy->ob_ival));return PyComplex_FromDoubles(return_value.r,return_value.i);
}
/*********************************** cswap ***********************************/
static char doc_blas_cswap[] = "None = _cswap(int(n),array(cx,'F'),int(incx),array(cy,'F'),int(incy))";
void F_FUNC(cswap,CSWAP)();
static PyObject *blas_cswap(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *cx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *cy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._cswap",&PyInt_Type,&n,&PyArray_Type,&cx,&PyInt_Type,&incx,&PyArray_Type,&cy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(cx,PyArray_CFLOAT,'F',2)) return NULL;
	if (!check_array_type(cy,PyArray_CFLOAT,'F',4)) return NULL;
	F_FUNC(cswap,CSWAP)(&(n->ob_ival),((complex_float*)(((PyArrayObject *)cx)->data)),&(incx->ob_ival),((complex_float*)(((PyArrayObject *)cy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** daxpy ***********************************/
static char doc_blas_daxpy[] = "None = _daxpy(int(n),float(da),array(dx,'d'),int(incx),array(dy,'d'),int(incy))";
void F_FUNC(daxpy,DAXPY)();
static PyObject *blas_daxpy(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyFloatObject	 *da=NULL;
	PyObject	 *dx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *dy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!:blas._daxpy",&PyInt_Type,&n,&PyFloat_Type,&da,&PyArray_Type,&dx,&PyInt_Type,&incx,&PyArray_Type,&dy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(dx,PyArray_DOUBLE,'d',3)) return NULL;
	if (!check_array_type(dy,PyArray_DOUBLE,'d',5)) return NULL;
	F_FUNC(daxpy,DAXPY)(&(n->ob_ival),&(da->ob_fval),((double*)(((PyArrayObject *)dx)->data)),&(incx->ob_ival),((double*)(((PyArrayObject *)dy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}
/************************************ ddot ************************************/
static char doc_blas_ddot[] = "float() = _ddot(int(n),array(dx,'d'),int(incx),array(dy,'d'),int(incy))";
double F_FUNC(ddot,DDOT)();
static PyObject *blas_ddot(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *dx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *dy=NULL;
	PyIntObject	 *incy=NULL;
	double	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._ddot",&PyInt_Type,&n,&PyArray_Type,&dx,&PyInt_Type,&incx,&PyArray_Type,&dy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(dx,PyArray_DOUBLE,'d',2)) return NULL;
	if (!check_array_type(dy,PyArray_DOUBLE,'d',4)) return NULL;
	return_value = F_FUNC(ddot,DDOT)(&(n->ob_ival),((double*)(((PyArrayObject *)dx)->data)),&(incx->ob_ival),((double*)(((PyArrayObject *)dy)->data)),&(incy->ob_ival));return PyFloat_FromDouble(return_value);
}
/************************************ dqag ************************************/
static char doc_blas_dqag[] = "None = _dqag(f,float(a),float(b),float(epsabs),float(epsrel),int(key),float(result),float(abserr),int(neval),int(ier),int(limit),int(lenw),int(last),array(iwork,'i'),array(work,'d'))";
void F_FUNC(dqag,DQAG)();PyObject *blas_py_function_dqag_f=NULL;
double blas_c_function_dqag_f (double* x) {
// do call back
}

static PyObject *blas_dqag(PyObject *self, PyObject *args) {
	PyFloatObject	 *a=NULL;
	PyFloatObject	 *b=NULL;
	PyFloatObject	 *epsabs=NULL;
	PyFloatObject	 *epsrel=NULL;
	PyIntObject	 *key=NULL;
	PyFloatObject	 *result=NULL;
	PyFloatObject	 *abserr=NULL;
	PyIntObject	 *neval=NULL;
	PyIntObject	 *ier=NULL;
	PyIntObject	 *limit=NULL;
	PyIntObject	 *lenw=NULL;
	PyIntObject	 *last=NULL;
	PyObject	 *iwork=NULL;
	PyObject	 *work=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!:blas._dqag",&PyFunction_Type,&blas_py_function_dqag_f,&PyFloat_Type,&a,&PyFloat_Type,&b,&PyFloat_Type,&epsabs,&PyFloat_Type,&epsrel,&PyInt_Type,&key,&PyFloat_Type,&result,&PyFloat_Type,&abserr,&PyInt_Type,&neval,&PyInt_Type,&ier,&PyInt_Type,&limit,&PyInt_Type,&lenw,&PyInt_Type,&last,&PyArray_Type,&iwork,&PyArray_Type,&work)) return NULL;
	if (!check_array_type(iwork,PyArray_LONG,'i',14)) return NULL;
	if (!check_array_shape(iwork,1,1,14,1,&(limit->ob_ival),11)) return NULL;
	if (!check_array_type(work,PyArray_DOUBLE,'d',15)) return NULL;
	if (!check_array_shape(work,1,1,15,1,&(lenw->ob_ival),12)) return NULL;
	F_FUNC(dqag,DQAG)(blas_c_function_dqag_f,&(a->ob_fval),&(b->ob_fval),&(epsabs->ob_fval),&(epsrel->ob_fval),&(key->ob_ival),&(result->ob_fval),&(abserr->ob_fval),&(neval->ob_ival),&(ier->ob_ival),&(limit->ob_ival),&(lenw->ob_ival),&(last->ob_ival),((long*)(((PyArrayObject *)iwork)->data)),((double*)(((PyArrayObject *)work)->data)));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** dswap ***********************************/
static char doc_blas_dswap[] = "None = _dswap(int(n),array(dx,'d'),int(incx),array(dy,'d'),int(incy))";
void F_FUNC(dswap,DSWAP)();
static PyObject *blas_dswap(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *dx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *dy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._dswap",&PyInt_Type,&n,&PyArray_Type,&dx,&PyInt_Type,&incx,&PyArray_Type,&dy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(dx,PyArray_DOUBLE,'d',2)) return NULL;
	if (!check_array_shape(dx,1,1,2,1,&(n->ob_ival),1)) return NULL;
	if (!check_array_type(dy,PyArray_DOUBLE,'d',4)) return NULL;
	if (!check_array_shape(dy,1,1,4,1,&(n->ob_ival),1)) return NULL;
	F_FUNC(dswap,DSWAP)(&(n->ob_ival),((double*)(((PyArrayObject *)dx)->data)),&(incx->ob_ival),((double*)(((PyArrayObject *)dy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** hybrd ***********************************/
static char doc_blas_hybrd[] = "None = _hybrd(fcn,int(n),array(x,'d'),array(fvec,'d'),float(xtol),int(maxfev),int(ml),int(mu),float(epsfcn),array(diag,'d'),int(mode),float(factor),int(nprint),int(info),int(nfev),array(fjac,'d'),int(ldfjac),array(r,'d'),int(lr),array(qtf,'d'),array(wa1,'d'),array(wa2,'d'),array(wa3,'d'),array(wa4,'d'))";
void F_FUNC(hybrd,HYBRD)();PyObject *blas_py_subroutine_hybrd_fcn=NULL;
void blas_c_subroutine_hybrd_fcn (long* n,double* x,double* fvec,long* iflag) {
// do call back
}

static PyObject *blas_hybrd(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *x=NULL;
	PyObject	 *fvec=NULL;
	PyFloatObject	 *xtol=NULL;
	PyIntObject	 *maxfev=NULL;
	PyIntObject	 *ml=NULL;
	PyIntObject	 *mu=NULL;
	PyFloatObject	 *epsfcn=NULL;
	PyObject	 *diag=NULL;
	PyIntObject	 *mode=NULL;
	PyFloatObject	 *factor=NULL;
	PyIntObject	 *nprint=NULL;
	PyIntObject	 *info=NULL;
	PyIntObject	 *nfev=NULL;
	PyObject	 *fjac=NULL;
	PyIntObject	 *ldfjac=NULL;
	PyObject	 *r=NULL;
	PyIntObject	 *lr=NULL;
	PyObject	 *qtf=NULL;
	PyObject	 *wa1=NULL;
	PyObject	 *wa2=NULL;
	PyObject	 *wa3=NULL;
	PyObject	 *wa4=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!O!:blas._hybrd",&PyFunction_Type,&blas_py_subroutine_hybrd_fcn,&PyInt_Type,&n,&PyArray_Type,&x,&PyArray_Type,&fvec,&PyFloat_Type,&xtol,&PyInt_Type,&maxfev,&PyInt_Type,&ml,&PyInt_Type,&mu,&PyFloat_Type,&epsfcn,&PyArray_Type,&diag,&PyInt_Type,&mode,&PyFloat_Type,&factor,&PyInt_Type,&nprint,&PyInt_Type,&info,&PyInt_Type,&nfev,&PyArray_Type,&fjac,&PyInt_Type,&ldfjac,&PyArray_Type,&r,&PyInt_Type,&lr,&PyArray_Type,&qtf,&PyArray_Type,&wa1,&PyArray_Type,&wa2,&PyArray_Type,&wa3,&PyArray_Type,&wa4)) return NULL;
	if (!check_array_type(x,PyArray_DOUBLE,'d',3)) return NULL;
	if (!check_array_shape(x,1,1,3,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(fvec,PyArray_DOUBLE,'d',4)) return NULL;
	if (!check_array_shape(fvec,1,1,4,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(diag,PyArray_DOUBLE,'d',10)) return NULL;
	if (!check_array_shape(diag,1,1,10,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(fjac,PyArray_DOUBLE,'d',16)) return NULL;
	if (!check_array_shape(fjac,2,2,16,1,&(ldfjac->ob_ival),17,2,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(r,PyArray_DOUBLE,'d',18)) return NULL;
	if (!check_array_shape(r,1,1,18,1,&(lr->ob_ival),19)) return NULL;
	if (!check_array_type(qtf,PyArray_DOUBLE,'d',20)) return NULL;
	if (!check_array_shape(qtf,1,1,20,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(wa1,PyArray_DOUBLE,'d',21)) return NULL;
	if (!check_array_shape(wa1,1,1,21,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(wa2,PyArray_DOUBLE,'d',22)) return NULL;
	if (!check_array_shape(wa2,1,1,22,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(wa3,PyArray_DOUBLE,'d',23)) return NULL;
	if (!check_array_shape(wa3,1,1,23,1,&(n->ob_ival),2)) return NULL;
	if (!check_array_type(wa4,PyArray_DOUBLE,'d',24)) return NULL;
	if (!check_array_shape(wa4,1,1,24,1,&(n->ob_ival),2)) return NULL;
	F_FUNC(hybrd,HYBRD)(blas_c_subroutine_hybrd_fcn,&(n->ob_ival),((double*)(((PyArrayObject *)x)->data)),((double*)(((PyArrayObject *)fvec)->data)),&(xtol->ob_fval),&(maxfev->ob_ival),&(ml->ob_ival),&(mu->ob_ival),&(epsfcn->ob_fval),((double*)(((PyArrayObject *)diag)->data)),&(mode->ob_ival),&(factor->ob_fval),&(nprint->ob_ival),&(info->ob_ival),&(nfev->ob_ival),((double*)(((PyArrayObject *)fjac)->data)),&(ldfjac->ob_ival),((double*)(((PyArrayObject *)r)->data)),&(lr->ob_ival),((double*)(((PyArrayObject *)qtf)->data)),((double*)(((PyArrayObject *)wa1)->data)),((double*)(((PyArrayObject *)wa2)->data)),((double*)(((PyArrayObject *)wa3)->data)),((double*)(((PyArrayObject *)wa4)->data)));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** saxpy ***********************************/
static char doc_blas_saxpy[] = "None = _saxpy(int(n),float(sa),array(sx,'f'),int(incx),array(sy,'f'),int(incy))";
void F_FUNC(saxpy,SAXPY)();
static PyObject *blas_saxpy(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyFloatObject	 *sa=NULL;
	float	 sa_tmp;
	PyObject	 *sx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *sy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!:blas._saxpy",&PyInt_Type,&n,&PyFloat_Type,&sa,&PyArray_Type,&sx,&PyInt_Type,&incx,&PyArray_Type,&sy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(sx,PyArray_FLOAT,'f',3)) return NULL;
	if (!check_array_type(sy,PyArray_FLOAT,'f',5)) return NULL;
	F_FUNC(saxpy,SAXPY)(&(n->ob_ival),&(sa_tmp=sa->ob_fval,sa_tmp),((float*)(((PyArrayObject *)sx)->data)),&(incx->ob_ival),((float*)(((PyArrayObject *)sy)->data)),&(incy->ob_ival));
	sa->ob_fval=sa_tmp;
	Py_INCREF(Py_None);
	return Py_None;
}
/************************************ sdot ************************************/
static char doc_blas_sdot[] = "float() = _sdot(int(n),array(sx,'f'),int(incx),array(sy,'f'),int(incy))";
float F_FUNC(sdot,SDOT)();
static PyObject *blas_sdot(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *sx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *sy=NULL;
	PyIntObject	 *incy=NULL;
	float	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._sdot",&PyInt_Type,&n,&PyArray_Type,&sx,&PyInt_Type,&incx,&PyArray_Type,&sy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(sx,PyArray_FLOAT,'f',2)) return NULL;
	if (!check_array_type(sy,PyArray_FLOAT,'f',4)) return NULL;
	return_value = F_FUNC(sdot,SDOT)(&(n->ob_ival),((float*)(((PyArrayObject *)sx)->data)),&(incx->ob_ival),((float*)(((PyArrayObject *)sy)->data)),&(incy->ob_ival));return PyFloat_FromDouble(return_value);
}
/*********************************** sswap ***********************************/
static char doc_blas_sswap[] = "None = _sswap(int(n),array(sx,'f'),int(incx),array(sy,'f'),int(incy))";
void F_FUNC(sswap,SSWAP)();
static PyObject *blas_sswap(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *sx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *sy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._sswap",&PyInt_Type,&n,&PyArray_Type,&sx,&PyInt_Type,&incx,&PyArray_Type,&sy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(sx,PyArray_FLOAT,'f',2)) return NULL;
	if (!check_array_type(sy,PyArray_FLOAT,'f',4)) return NULL;
	F_FUNC(sswap,SSWAP)(&(n->ob_ival),((float*)(((PyArrayObject *)sx)->data)),&(incx->ob_ival),((float*)(((PyArrayObject *)sy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** zaxpy ***********************************/
static char doc_blas_zaxpy[] = "None = _zaxpy(int(n),complex(za),array(zx,'D'),int(incx),array(zy,'D'),int(incy))";
void F_FUNC(zaxpy,ZAXPY)();
static PyObject *blas_zaxpy(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyComplexObject	 *za=NULL;
	PyObject	 *zx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *zy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!O!:blas._zaxpy",&PyInt_Type,&n,&PyComplex_Type,&za,&PyArray_Type,&zx,&PyInt_Type,&incx,&PyArray_Type,&zy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(zx,PyArray_CDOUBLE,'D',3)) return NULL;
	if (!check_array_type(zy,PyArray_CDOUBLE,'D',5)) return NULL;
	F_FUNC(zaxpy,ZAXPY)(&(n->ob_ival),&(za->cval),((complex_double*)(((PyArrayObject *)zx)->data)),&(incx->ob_ival),((complex_double*)(((PyArrayObject *)zy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}
/*********************************** zdotc ***********************************/
static char doc_blas_zdotc[] = "complex() = _zdotc(int(n),array(zx,'D'),int(incx),array(zy,'D'),int(incy))";
complex_double F_FUNC(zdotc,ZDOTC)();
static PyObject *blas_zdotc(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *zx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *zy=NULL;
	PyIntObject	 *incy=NULL;
	complex_double	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._zdotc",&PyInt_Type,&n,&PyArray_Type,&zx,&PyInt_Type,&incx,&PyArray_Type,&zy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(zx,PyArray_CDOUBLE,'D',2)) return NULL;
	if (!check_array_type(zy,PyArray_CDOUBLE,'D',4)) return NULL;
	return_value = F_FUNC(zdotc,ZDOTC)(&(n->ob_ival),((complex_double*)(((PyArrayObject *)zx)->data)),&(incx->ob_ival),((complex_double*)(((PyArrayObject *)zy)->data)),&(incy->ob_ival));return PyComplex_FromDoubles(return_value.r,return_value.i);
}
/*********************************** zdotu ***********************************/
static char doc_blas_zdotu[] = "complex() = _zdotu(int(n),array(zx,'D'),int(incx),array(zy,'D'),int(incy))";
complex_double F_FUNC(zdotu,ZDOTU)();
static PyObject *blas_zdotu(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *zx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *zy=NULL;
	PyIntObject	 *incy=NULL;
	complex_double	 return_value;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._zdotu",&PyInt_Type,&n,&PyArray_Type,&zx,&PyInt_Type,&incx,&PyArray_Type,&zy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(zx,PyArray_CDOUBLE,'D',2)) return NULL;
	if (!check_array_type(zy,PyArray_CDOUBLE,'D',4)) return NULL;
	return_value = F_FUNC(zdotu,ZDOTU)(&(n->ob_ival),((complex_double*)(((PyArrayObject *)zx)->data)),&(incx->ob_ival),((complex_double*)(((PyArrayObject *)zy)->data)),&(incy->ob_ival));return PyComplex_FromDoubles(return_value.r,return_value.i);
}
/*********************************** zswap ***********************************/
static char doc_blas_zswap[] = "None = _zswap(int(n),array(zx,'D'),int(incx),array(zy,'D'),int(incy))";
void F_FUNC(zswap,ZSWAP)();
static PyObject *blas_zswap(PyObject *self, PyObject *args) {
	PyIntObject	 *n=NULL;
	PyObject	 *zx=NULL;
	PyIntObject	 *incx=NULL;
	PyObject	 *zy=NULL;
	PyIntObject	 *incy=NULL;
	if (!PyArg_ParseTuple(args,"O!O!O!O!O!:blas._zswap",&PyInt_Type,&n,&PyArray_Type,&zx,&PyInt_Type,&incx,&PyArray_Type,&zy,&PyInt_Type,&incy)) return NULL;
	if (!check_array_type(zx,PyArray_CDOUBLE,'D',2)) return NULL;
	if (!check_array_type(zy,PyArray_CDOUBLE,'D',4)) return NULL;
	F_FUNC(zswap,ZSWAP)(&(n->ob_ival),((complex_double*)(((PyArrayObject *)zx)->data)),&(incx->ob_ival),((complex_double*)(((PyArrayObject *)zy)->data)),&(incy->ob_ival));
	Py_INCREF(Py_None);
	return Py_None;
}

/******************************************************************************/

static PyMethodDef blas_module_methods[] = {
	{"_caxpy",blas_caxpy,METH_VARARGS,doc_blas_caxpy},
	{"_cdotc",blas_cdotc,METH_VARARGS,doc_blas_cdotc},
	{"_cdotu",blas_cdotu,METH_VARARGS,doc_blas_cdotu},
	{"_cswap",blas_cswap,METH_VARARGS,doc_blas_cswap},
	{"_daxpy",blas_daxpy,METH_VARARGS,doc_blas_daxpy},
	{"_ddot",blas_ddot,METH_VARARGS,doc_blas_ddot},
	{"_dqag",blas_dqag,METH_VARARGS,doc_blas_dqag},
	{"_dswap",blas_dswap,METH_VARARGS,doc_blas_dswap},
	{"_hybrd",blas_hybrd,METH_VARARGS,doc_blas_hybrd},
	{"_saxpy",blas_saxpy,METH_VARARGS,doc_blas_saxpy},
	{"_sdot",blas_sdot,METH_VARARGS,doc_blas_sdot},
	{"_sswap",blas_sswap,METH_VARARGS,doc_blas_sswap},
	{"_zaxpy",blas_zaxpy,METH_VARARGS,doc_blas_zaxpy},
	{"_zdotc",blas_zdotc,METH_VARARGS,doc_blas_zdotc},
	{"_zdotu",blas_zdotu,METH_VARARGS,doc_blas_zdotu},
	{"_zswap",blas_zswap,METH_VARARGS,doc_blas_zswap},
	{NULL,NULL}
};
void initblas() {
  PyObject *m, *d, *s;
  m = Py_InitModule("blas", blas_module_methods);
  import_array();
  d = PyModule_GetDict(m);
  s = PyString_FromString("$Revision:$");
  PyDict_SetItemString(d, "__version__", s);
  blas_error = PyErr_NewException ("blas.error", NULL, NULL);
  Py_DECREF(s);
  if (PyErr_Occurred())
    Py_FatalError("can't initialize module blas");
}
