/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3u-20010227-1913 (Alpha 5)
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

#define SWIGPYTHON
/***********************************************************************
 * common.swg
 *
 *     This file contains generic SWIG runtime support for pointer
 *     type checking as well as a few commonly used macros to control
 *     external linkage.
 *
 * Author : David Beazley (beazley@cs.uchicago.edu)
 *
 * Copyright (c) 1999-2000, The University of Chicago
 * 
 * This file may be freely redistributed without license or fee provided
 * this copyright message remains intact.
 ************************************************************************/

#include <string.h>

#if defined(_WIN32) || defined(__WIN32__)
#       if defined(_MSC_VER)
#               if defined(STATIC_LINKED)
#                       define SWIGEXPORT(a) a
#               else
#                       define SWIGEXPORT(a) __declspec(dllexport) a
#               endif
#       else
#               if defined(__BORLANDC__)
#                       define SWIGEXPORT(a) a _export
#               else
#                       define SWIGEXPORT(a) a
#       endif
#endif
#else
#       define SWIGEXPORT(a) a
#endif

#ifdef SWIG_GLOBAL
#define SWIGRUNTIME(a) SWIGEXPORT(a)
#else
#define SWIGRUNTIME(a) static a
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct swig_type_info {
  char  *name;                 
  void *(*converter)(void *);
  char  *str;
  struct swig_type_info  *next;
  struct swig_type_info  *prev;
} swig_type_info;

#ifdef SWIG_NOINCLUDE
SWIGEXPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
SWIGEXPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
SWIGEXPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
#else

static swig_type_info *swig_type_list = 0;

/* Register a type mapping with the type-checking */
SWIGRUNTIME(swig_type_info *)
SWIG_TypeRegister(swig_type_info *ti)
{
  swig_type_info *tc, *head, *ret, *next;
  /* Check to see if this type has already been registered */
  tc = swig_type_list;
  while (tc) {
    if (strcmp(tc->name, ti->name) == 0) {
      /* Already exists in the table.  Just add additional types to the list */
      head = tc;
      next = tc->next;
      goto l1;
    }
    tc = tc->prev;
  }
  head = ti;
  next = 0;

  /* Place in list */
  ti->prev = swig_type_list;
  swig_type_list = ti;

  /* Build linked lists */
 l1:
  ret = head;
  tc = ti + 1;
  /* Patch up the rest of the links */
  while (tc->name) {
    head->next = tc;
    tc->prev = head;
    head = tc;
    tc++;
  }
  head->next = next;
  return ret;
}

/* Check the typename */
SWIGRUNTIME(swig_type_info *) 
SWIG_TypeCheck(char *c, swig_type_info *ty)
{
  swig_type_info *s;
  if (!ty) return 0;        /* Void pointer */
  s = ty->next;             /* First element always just a name */
  while (s) {
    if (strcmp(s->name,c) == 0) {
      if (s == ty->next) return s;
      /* Move s to the top of the linked list */
      s->prev->next = s->next;
      if (s->next) {
	s->next->prev = s->prev;
      }
      /* Insert s as second element in the list */
      s->next = ty->next;
      if (ty->next) ty->next->prev = s;
      ty->next = s;
      return s;
    }
    s = s->next;
  }
  return 0;
}

/* Cast a pointer (needed for C++ inheritance */
SWIGRUNTIME(void *) 
SWIG_TypeCast(swig_type_info *ty, void *ptr) 
{
  if ((!ty) || (!ty->converter)) return ptr;
  return (*ty->converter)(ptr);
}

/* Search for a swig_type_info structure */
SWIGRUNTIME(void *)
SWIG_TypeQuery(const char *name) {
  swig_type_info *ty = swig_type_list;
  while (ty) {
    if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
    if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
    ty = ty->prev;
  }
  return 0;
}

#endif

#ifdef __cplusplus
}
#endif



/***********************************************************************
 * python.swg
 *
 *     This file contains the runtime support for Python modules
 *     and includes code for managing global variables and pointer
 *     type checking.
 *
 * Author : David Beazley (beazley@cs.uchicago.edu)
 ************************************************************************/

#include <stdlib.h>
#include "Python.h"

#ifdef __cplusplus
extern "C" {
#endif

#define SWIG_PY_INT     1
#define SWIG_PY_FLOAT   2
#define SWIG_PY_STRING  3
#define SWIG_PY_POINTER 4

/* Constant information structure */
typedef struct swig_const_info {
    int type;
    char *name;
    long lvalue;
    double dvalue;
    void   *pvalue;
    swig_type_info **ptype;
} swig_const_info;

#ifdef SWIG_NOINCLUDE

SWIGEXPORT(PyObject *)        SWIG_newvarlink();
SWIGEXPORT(void)              SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
SWIGEXPORT(int)               SWIG_ConvertPtr(PyObject *, void **, swig_type_info *, int);
SWIGEXPORT(void)              SWIG_MakePtr(char *c, void *, swig_type_info *);
SWIGEXPORT(PyObject *)        SWIG_NewPointerObj(void *, swig_type_info *);
SWIGEXPORT(void)              SWIG_InstallConstants(PyObject *d, swig_const_info constants[]);

#else

/* -----------------------------------------------------------------------------
 * global variable support code.
 * ----------------------------------------------------------------------------- */

typedef struct swig_globalvar {   
  char       *name;                  /* Name of global variable */
  PyObject *(*get_attr)(void);       /* Return the current value */
  int       (*set_attr)(PyObject *); /* Set the value */
  struct swig_globalvar *next;
} swig_globalvar;

typedef struct swig_varlinkobject {
  PyObject_HEAD
  swig_globalvar *vars;
} swig_varlinkobject;

static PyObject *
swig_varlink_repr(swig_varlinkobject *v) {
  v = v;
  return PyString_FromString("<Global variables>");
}

static int
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
  swig_globalvar  *var;
  flags = flags;
  fprintf(fp,"Global variables { ");
  for (var = v->vars; var; var=var->next) {
    fprintf(fp,"%s", var->name);
    if (var->next) fprintf(fp,", ");
  }
  fprintf(fp," }\n");
  return 0;
}

static PyObject *
swig_varlink_getattr(swig_varlinkobject *v, char *n) {
  swig_globalvar *var = v->vars;
  while (var) {
    if (strcmp(var->name,n) == 0) {
      return (*var->get_attr)();
    }
    var = var->next;
  }
  PyErr_SetString(PyExc_NameError,"Unknown C global variable");
  return NULL;
}

static int
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
  swig_globalvar *var = v->vars;
  while (var) {
    if (strcmp(var->name,n) == 0) {
      return (*var->set_attr)(p);
    }
    var = var->next;
  }
  PyErr_SetString(PyExc_NameError,"Unknown C global variable");
  return 1;
}

statichere PyTypeObject varlinktype = {
  PyObject_HEAD_INIT(0)              
  0,
  "swigvarlink",                      /* Type name    */
  sizeof(swig_varlinkobject),         /* Basic size   */
  0,                                  /* Itemsize     */
  0,                                  /* Deallocator  */ 
  (printfunc) swig_varlink_print,     /* Print        */
  (getattrfunc) swig_varlink_getattr, /* get attr     */
  (setattrfunc) swig_varlink_setattr, /* Set attr     */
  0,                                  /* tp_compare   */
  (reprfunc) swig_varlink_repr,       /* tp_repr      */    
  0,                                  /* tp_as_number */
  0,                                  /* tp_as_mapping*/
  0,                                  /* tp_hash      */
};

/* Create a variable linking object for use later */
SWIGRUNTIME(PyObject *)
SWIG_newvarlink(void) {
  swig_varlinkobject *result = 0;
  result = PyMem_NEW(swig_varlinkobject,1);
  varlinktype.ob_type = &PyType_Type;    /* Patch varlinktype into a PyType */
  result->ob_type = &varlinktype;
  result->vars = 0;
  result->ob_refcnt = 0;
  Py_XINCREF((PyObject *) result);
  return ((PyObject*) result);
}

SWIGRUNTIME(void)
SWIG_addvarlink(PyObject *p, char *name,
	   PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
  swig_varlinkobject *v;
  swig_globalvar *gv;
  v= (swig_varlinkobject *) p;
  gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
  gv->name = (char *) malloc(strlen(name)+1);
  strcpy(gv->name,name);
  gv->get_attr = get_attr;
  gv->set_attr = set_attr;
  gv->next = v->vars;
  v->vars = gv;
}
/* Convert a pointer value */
SWIGRUNTIME(int)
SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
  unsigned long p;
  register int d;
  swig_type_info *tc;
  char  *c;
  static PyObject *SWIG_this = 0;
  int    newref = 0;

  if (!obj || (obj == Py_None)) {
    *ptr = 0;
    return 0;
  }
#ifdef SWIG_COBJECT_TYPES
  if (!(PyCObject_Check(obj))) {
    if (!SWIG_this)
      SWIG_this = PyString_InternFromString("this");
    obj = PyObject_GetAttr(obj,SWIG_this);
    newref = 1;
    if (!obj) goto type_error;
    if (!PyCObject_Check(obj)) {
      Py_DECREF(obj);
      goto type_error;
    }
  } 
  *ptr = PyCObject_AsVoidPtr(obj);
  c = (char *) PyCObject_GetDesc(obj);
  if (newref) Py_DECREF(obj);
  goto cobject;
#else
  if (!(PyString_Check(obj))) {
    if (!SWIG_this)
      SWIG_this = PyString_InternFromString("this");
    obj = PyObject_GetAttr(obj,SWIG_this);
    newref = 1;
    if (!obj) goto type_error;
    if (!PyString_Check(obj)) {
      Py_DECREF(obj);
      goto type_error;
    }
  } 
  c = PyString_AsString(obj);
  p = 0;
  /* Pointer values must start with leading underscore */
  if (*c != '_') {
    *ptr = (void *) 0;
    if (strcmp(c,"NULL") == 0) {
      if (newref) Py_DECREF(obj);
      return 0;
    } else {
      if (newref) Py_DECREF(obj);
      goto type_error;
    }
  }
  c++;
  /* Extract hex value from pointer */
  while ((d = *c)) {
    if ((d >= '0') && (d <= '9'))
      p = (p << 4) + (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      p = (p << 4) + (d - ('a'-10));
    else
      break; 
    c++;
  }
  *ptr = (void *) p;
  if (newref) Py_DECREF(obj);
#endif

#ifdef SWIG_COBJECT_TYPES
cobject:
#endif

  if (ty) {
    tc = SWIG_TypeCheck(c,ty);
    if (!tc) goto type_error;
    *ptr = SWIG_TypeCast(tc,(void*)p);
  }
  return 0;

type_error:

  if (flags) {
    if (ty) {
      char *temp = (char *) malloc(64+strlen(ty->name));
      sprintf(temp,"Type error. Expected %s", ty->name);
      PyErr_SetString(PyExc_TypeError, temp);
      free((char *) temp);
    } else {
      PyErr_SetString(PyExc_TypeError,"Expected a pointer");
    }
  }
  return -1;
}

/* Take a pointer and convert it to a string */
SWIGRUNTIME(void) 
SWIG_MakePtr(char *c, void *ptr, swig_type_info *ty) {
  static char hex[17] = "0123456789abcdef";
  unsigned long p, s;
  char result[32], *r; 
  r = result;
  p = (unsigned long) ptr;
  if (p > 0) {
    while (p > 0) {
      s = p & 0xf;
      *(r++) = hex[s];
      p = p >> 4;
    }
    *r = '_';
    while (r >= result)
      *(c++) = *(r--);
    strcpy (c, ty->name);
  } else {
    strcpy (c, "NULL");
  }
}

/* Create a new pointer object */
SWIGRUNTIME(PyObject *)
SWIG_NewPointerObj(void *ptr, swig_type_info *type) {
  char result[512];
  PyObject *robj;
  if (!ptr) {
    Py_INCREF(Py_None);
    return Py_None;
  }
#ifdef SWIG_COBJECT_TYPES
  robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, type->name, NULL);
#else
  SWIG_MakePtr(result,ptr,type);
  robj = PyString_FromString(result);
#endif
  return robj;
}

/* Install Constants */
SWIGRUNTIME(void)
SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) {
  int i;
  PyObject *obj;
  for (i = 0; constants[i].type; i++) {
    switch(constants[i].type) {
    case SWIG_PY_INT:
      obj = PyInt_FromLong(constants[i].lvalue);
      break;
    case SWIG_PY_FLOAT:
      obj = PyFloat_FromDouble(constants[i].dvalue);
      break;
    case SWIG_PY_STRING:
      obj = PyString_FromString((char *) constants[i].pvalue);
      break;
    case SWIG_PY_POINTER:
      obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype);
      break;
    default:
      obj = 0;
      break;
    }
    if (obj) {
      PyDict_SetItemString(d,constants[i].name,obj);
      Py_DECREF(obj);
    }
  }
}

#endif

#ifdef __cplusplus
}
#endif



/* -------- TYPES TABLE (BEGIN) -------- */

static swig_type_info *swig_types[1];

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    init_vq

#define SWIG_name    "_vq"


#include "vq.h"

/* Wrappers for the template code */

void float_vq(float * obs,float* code_book, int Nobs, int Ncodes, 
              int Nfeatures, int* codes, float* lowest_dist)
{
    tvq<float>(obs,code_book,Nobs,Ncodes,Nfeatures,codes,lowest_dist);
}

void double_vq(double * obs,double* code_book, int Nobs, int Ncodes, 
              int Nfeatures, int* codes, double* lowest_dist)
{
    tvq<double>(obs,code_book,Nobs,Ncodes,Nfeatures,codes,lowest_dist);
}


static PyObject* l_output_helper(PyObject* target, PyObject* o) {
    PyObject*   o2;
    if (!target) {                   
        target = o;
    } else if (target == Py_None) {  
        Py_DECREF(Py_None);
        target = o;
    } else {                         
        if (!PyList_Check(target)) {
            o2 = target;
            target = PyList_New(0);
            PyList_Append(target, o2);
	    Py_XDECREF(o2);
        }
        PyList_Append(target,o);
	Py_XDECREF(o);
    }
    return target;
}

static PyObject* t_output_helper(PyObject* target, PyObject* o) {
    PyObject*   o2;
    PyObject*   o3;

    if (!target) {                   
        target = o;
    } else if (target == Py_None) {  
        Py_DECREF(Py_None);
        target = o;
    } else {                         
        if (!PyTuple_Check(target)) {
            o2 = target;
            target = PyTuple_New(1);
            PyTuple_SetItem(target, 0, o2);
        }
        o3 = PyTuple_New(1);            
        PyTuple_SetItem(o3, 0, o);      

        o2 = target;
        target = PySequence_Concat(o2, o3); 
        Py_DECREF(o2);                      
        Py_DECREF(o3);
    }
    return target;
}


#include "Numeric/arrayobject.h"

// hmmm. how do we prevent typedefs from conflicting
// with users definition on complex numbers?
//#include "complex_test.h"
//typedef struct{ float real; 
//                float imag;} complex;
//typedef struct{ double real; 
//                double imag;} zcomplex;


// used for converting typecodes to memory sizes.
int char_to_size(char type)
{
    if (type=='i') return sizeof(int);
    if (type=='f') return sizeof(float);
    if (type=='d') return sizeof(double);
    if (type=='c') return 2*sizeof(float);
    if (type=='z') return 2*sizeof(double);
}
int char_to_numtype(char type)
{
    if (type=='i') return 'i';
    if (type=='f') return 'f';
    if (type=='d') return 'd';
    if (type=='c') return 'F';
    if (type=='z') return 'D';
}


typedef int int_IN_D0;
typedef float float_IN_D0;
typedef double double_IN_D0;
typedef int int_IN_D1;
typedef float float_IN_D1;
typedef double double_IN_D1;
typedef int int_IN_D2;
typedef float float_IN_D2;
typedef double double_IN_D2;
typedef int int_IN_D0_D1;
typedef float float_IN_D0_D1;
typedef double double_IN_D0_D1;
typedef int int_IN_D0_D2;
typedef float float_IN_D0_D2;
typedef double double_IN_D0_D2;
typedef int int_IN_D1_D2;
typedef float float_IN_D1_D2;
typedef double double_IN_D1_D2;
typedef int int_IN_D0_D1_D2;
typedef float float_IN_D0_D1_D2;
typedef double double_IN_D0_D1_D2;


typedef int int_ARGOUT_D0;
typedef float float_ARGOUT_D0;
typedef double double_ARGOUT_D0;
typedef int int_ARGOUT_D1;
typedef float float_ARGOUT_D1;
typedef double double_ARGOUT_D1;
typedef int int_ARGOUT_D2;
typedef float float_ARGOUT_D2;
typedef double double_ARGOUT_D2;
typedef int int_ARGOUT_D0_D1;
typedef float float_ARGOUT_D0_D1;
typedef double double_ARGOUT_D0_D1;
typedef int int_ARGOUT_D0_D2;
typedef float float_ARGOUT_D0_D2;
typedef double double_ARGOUT_D0_D2;
typedef int int_ARGOUT_D1_D2;
typedef float float_ARGOUT_D1_D2;
typedef double double_ARGOUT_D1_D2;
typedef int int_ARGOUT_D0_D1_D2;
typedef float float_ARGOUT_D0_D1_D2;
typedef double double_ARGOUT_D0_D1_D2;


typedef int int_ARGOUT_TUPLE_D0;
typedef float float_ARGOUT_TUPLE_D0;
typedef double double_ARGOUT_TUPLE_D0;
typedef int int_ARGOUT_TUPLE_D1;
typedef float float_ARGOUT_TUPLE_D1;
typedef double double_ARGOUT_TUPLE_D1;
typedef int int_ARGOUT_TUPLE_D2;
typedef float float_ARGOUT_TUPLE_D2;
typedef double double_ARGOUT_TUPLE_D2;
typedef int int_ARGOUT_TUPLE_D0_D1;
typedef float float_ARGOUT_TUPLE_D0_D1;
typedef double double_ARGOUT_TUPLE_D0_D1;
typedef int int_ARGOUT_TUPLE_D0_D2;
typedef float float_ARGOUT_TUPLE_D0_D2;
typedef double double_ARGOUT_TUPLE_D0_D2;
typedef int int_ARGOUT_TUPLE_D1_D2;
typedef float float_ARGOUT_TUPLE_D1_D2;
typedef double double_ARGOUT_TUPLE_D1_D2;
typedef int int_ARGOUT_TUPLE_D0_D1_D2;
typedef float float_ARGOUT_TUPLE_D0_D1_D2;
typedef double double_ARGOUT_TUPLE_D0_D1_D2;


typedef int int_OUT_D0;
typedef float float_OUT_D0;
typedef double double_OUT_D0;
typedef int int_OUT_D1;
typedef float float_OUT_D1;
typedef double double_OUT_D1;
typedef int int_OUT_D2;
typedef float float_OUT_D2;
typedef double double_OUT_D2;
typedef int int_OUT_D0_D1;
typedef float float_OUT_D0_D1;
typedef double double_OUT_D0_D1;
typedef int int_OUT_D0_D2;
typedef float float_OUT_D0_D2;
typedef double double_OUT_D0_D2;
typedef int int_OUT_D1_D2;
typedef float float_OUT_D1_D2;
typedef double double_OUT_D1_D2;
typedef int int_OUT_D0_D1_D2;
typedef float float_OUT_D0_D1_D2;
typedef double double_OUT_D0_D1_D2;


                                                                        
PyArrayObject* IN_in(PyObject* source, char* basetype_string,             
                             int** target_dims, int dims)                 
{                                                                         
    PyArrayObject *a_obj;                                                 
    char ar_type = char_to_numtype(basetype_string[0]);                   
    a_obj = (PyArrayObject*) PyArray_ContiguousFromObject(source,ar_type, 
                                                             dims,dims);  
    if (a_obj == NULL)                                                    
    {                                                                     
        //PyArray Contiguous From Object will set the error value.        
    	return NULL;                                                      
    }                                                                     
    for(int i = 0; i < dims;i++)                                          
    {                                                                     
        *(target_dims[i]) = a_obj->dimensions[i];                         
    }                                                                     
    return a_obj;                                                         
}                                                                         
                                                                          

char* ARGOUT_check(char* basetype_string,int* dims, int dim_len)
{
    char *rdata;
    int element_size = char_to_size(basetype_string[0]);
    int tot_length = 1;
    for (int i = 0; i < dim_len; i++)
        tot_length *= dims[i];        
    rdata = (char*)malloc(tot_length*element_size);
    if(rdata == NULL)
	{
	    PyErr_SetString(PyExc_MemoryError, "can't allocate memory for output array for arg$argnum");
	    return NULL;
	}	
    return rdata;
}

PyObject* ARGOUT_argout(char* source, char* basetype_string, 
                                int* dims, int dim_len)
{
    PyArrayObject *res;
    char array_type = char_to_numtype(basetype_string[0]);
    res = (PyArrayObject *)PyArray_FromDimsAndData(dim_len, dims, 
                                                   array_type,source);
    if(res == NULL)
    {
        //PyErr_SetString(PyExc_ValueError, "error converting internal data to array");
    	return NULL;
    }
    res->flags |= OWN_DATA; // we want the array to deallocate mem when it is finished.
    // stick result in the output tuple (target).
    // Need to think about generality of this one...
    return (PyObject *) res;
}
#ifdef __cplusplus
extern "C" {
#endif
static PyObject *_wrap_double_vq(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    double_IN_D0_D2 *arg0 ;
    double_IN_D1_D2 *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int_ARGOUT_TUPLE_D0 *arg5 ;
    double_ARGOUT_TUPLE_D0 *arg6 ;
    int *_d0 ;
    int *_d1 ;
    int *_d2 ;
    PyObject * obj0  = 0 ;
    PyObject * obj1  = 0 ;
    
    {
        _d0 = &arg2; 
    }
    {
        _d1 = &arg3; 
    }
    {
        _d2 = &arg4; 
    }
    {
    }
    {
    }
    if(!PyArg_ParseTuple(args,"OO:double_vq",&obj0,&obj1)) return NULL;
    {
        int* targ_dims[2] = {
            _d0,_d2
        };
        PyArrayObject* a_obj = IN_in(obj0,"double_IN_D0_D2",targ_dims,2);
        if (a_obj == NULL) return NULL;
        arg0 = (double_IN_D0_D2 *) a_obj->data;
        obj0 = (PyObject*)a_obj;
    }
    {
        int* targ_dims[2] = {
            _d1,_d2
        };
        PyArrayObject* a_obj = IN_in(obj1,"double_IN_D1_D2",targ_dims,2);
        if (a_obj == NULL) return NULL;
        arg1 = (double_IN_D1_D2 *) a_obj->data;
        obj1 = (PyObject*)a_obj;
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        arg5 = (int_ARGOUT_TUPLE_D0 *) ARGOUT_check("int_ARGOUT_TUPLE_D0",dims,dim_len);
        if (arg5 == NULL) return NULL;
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        arg6 = (double_ARGOUT_TUPLE_D0 *) ARGOUT_check("double_ARGOUT_TUPLE_D0",dims,dim_len);
        if (arg6 == NULL) return NULL;
    }
    double_vq(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
    Py_INCREF(Py_None);
    resultobj = Py_None;
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        PyObject * res;
        res = ARGOUT_argout( (char*) arg5,"int_ARGOUT_TUPLE_D0",
        dims, dim_len);
        if (resultobj == NULL) 
        return NULL;
        resultobj = t_output_helper(resultobj, res);
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        PyObject * res;
        res = ARGOUT_argout( (char*) arg6,"double_ARGOUT_TUPLE_D0",
        dims, dim_len);
        if (resultobj == NULL) 
        return NULL;
        resultobj = t_output_helper(resultobj, res);
    }
    {
        Py_XDECREF(obj0); 
    }
    {
        Py_XDECREF(obj1); 
    }
    return resultobj;
}


static PyObject *_wrap_float_vq(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    float_IN_D0_D2 *arg0 ;
    float_IN_D1_D2 *arg1 ;
    int arg2 ;
    int arg3 ;
    int arg4 ;
    int_ARGOUT_TUPLE_D0 *arg5 ;
    float_ARGOUT_TUPLE_D0 *arg6 ;
    int *_d0 ;
    int *_d1 ;
    int *_d2 ;
    PyObject * obj0  = 0 ;
    PyObject * obj1  = 0 ;
    
    {
        _d0 = &arg2; 
    }
    {
        _d1 = &arg3; 
    }
    {
        _d2 = &arg4; 
    }
    {
    }
    {
    }
    if(!PyArg_ParseTuple(args,"OO:float_vq",&obj0,&obj1)) return NULL;
    {
        int* targ_dims[2] = {
            _d0,_d2
        };
        PyArrayObject* a_obj = IN_in(obj0,"float_IN_D0_D2",targ_dims,2);
        if (a_obj == NULL) return NULL;
        arg0 = (float_IN_D0_D2 *) a_obj->data;
        obj0 = (PyObject*)a_obj;
    }
    {
        int* targ_dims[2] = {
            _d1,_d2
        };
        PyArrayObject* a_obj = IN_in(obj1,"float_IN_D1_D2",targ_dims,2);
        if (a_obj == NULL) return NULL;
        arg1 = (float_IN_D1_D2 *) a_obj->data;
        obj1 = (PyObject*)a_obj;
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        arg5 = (int_ARGOUT_TUPLE_D0 *) ARGOUT_check("int_ARGOUT_TUPLE_D0",dims,dim_len);
        if (arg5 == NULL) return NULL;
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        arg6 = (float_ARGOUT_TUPLE_D0 *) ARGOUT_check("float_ARGOUT_TUPLE_D0",dims,dim_len);
        if (arg6 == NULL) return NULL;
    }
    float_vq(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
    Py_INCREF(Py_None);
    resultobj = Py_None;
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        PyObject * res;
        res = ARGOUT_argout( (char*) arg5,"int_ARGOUT_TUPLE_D0",
        dims, dim_len);
        if (resultobj == NULL) 
        return NULL;
        resultobj = t_output_helper(resultobj, res);
    }
    {
        int dim_len = 1;
        int dims[1] = {
            *_d0
        };
        PyObject * res;
        res = ARGOUT_argout( (char*) arg6,"float_ARGOUT_TUPLE_D0",
        dims, dim_len);
        if (resultobj == NULL) 
        return NULL;
        resultobj = t_output_helper(resultobj, res);
    }
    {
        Py_XDECREF(obj0); 
    }
    {
        Py_XDECREF(obj1); 
    }
    return resultobj;
}


static PyMethodDef _vqMethods[] = {
	 { "double_vq", _wrap_double_vq, METH_VARARGS },
	 { "float_vq", _wrap_float_vq, METH_VARARGS },
	 { NULL, NULL }
};

#ifdef __cplusplus
}
#endif

/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */


static swig_type_info *swig_types_initial[] = {
0
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

static swig_const_info swig_const_table[] = {
{0}};

static PyObject *SWIG_globals;
#ifdef __cplusplus
extern "C" 
#endif
SWIGEXPORT(void) init_vq(void) {
    PyObject *m, *d;
    int i;
    SWIG_globals = SWIG_newvarlink();
    m = Py_InitModule("_vq", _vqMethods);
    d = PyModule_GetDict(m);
    for (i = 0; swig_types_initial[i]; i++) {
        swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
    }
    
    import_array();
    SWIG_InstallConstants(d,swig_const_table);
}

