/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.2
 *
 * 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
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#define SWIG_PYTHON_OUTPUT_TUPLE
#define SWIG_CASTRANK_MODE
#define SWIG_PYTHON_CAST_MODE


#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
  struct SwigMovePointer {
    T *ptr;
    SwigMovePointer(T *p) : ptr(p) { }
    ~SwigMovePointer() { delete ptr; }
    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
  } pointer;
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
  SwigValueWrapper() : pointer(0) { }
  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
  operator T&() const { return *pointer.ptr; }
  T *operator&() { return pointer.ptr; }
};

template <typename T> T SwigValueInit() {
  return T();
}
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__))
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__))
# else
#   define SWIGUNUSED
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif



#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
# define _DEBUG
#else
# include <Python.h>
#endif

/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic C API SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.

  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/*
   Flags/methods for returning states.

   The SWIG conversion methods, as ConvertPtr, return an integer
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).

   Use the following macros/flags to set or process the returning
   states.

   In old versions of SWIG, code such as the following was usually written:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   which is the same really, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }

   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   also requires SWIG_ConvertPtr to return new result values, such as

      int SWIG_ConvertPtr(obj, ptr,...) {
        if (<obj is ok>) {
          if (<need new object>) {
            *ptr = <ptr to new allocated object>;
            return SWIG_NEWOBJ;
          } else {
            *ptr = <ptr to old object>;
            return SWIG_OLDOBJ;
          }
        } else {
          return SWIG_BADOBJ;
        }
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   SWIG errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call

      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
*/

#define SWIG_OK                    (0)
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
#  define SWIG_AddCast(r) (r)
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store information on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/*
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCmp(const char *nb, const char *tb) {
  int equiv = 1;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (equiv != 0 && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}

/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

/*
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/*
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;

  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}

/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
                            swig_module_info *end,
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      size_t l = 0;
      size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	size_t i = (l + r) >> 1;
	const char *iname = iter->types[i]->name;
	if (iname) {
	  int compare = strcmp(name, iname);
	  if (compare == 0) {
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
                     swig_module_info *end,
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }

  /* neither found a match */
  return 0;
}

/*
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  const unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/*
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    char d = *(c++);
    unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = ((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = ((d - ('a'-10)) << 4);
    else
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (d - ('a'-10));
    else
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/*
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
#define  SWIG_UnknownError    	   -1
#define  SWIG_IOError        	   -2
#define  SWIG_RuntimeError   	   -3
#define  SWIG_IndexError     	   -4
#define  SWIG_TypeError      	   -5
#define  SWIG_DivisionByZero 	   -6
#define  SWIG_OverflowError  	   -7
#define  SWIG_SyntaxError    	   -8
#define  SWIG_ValueError     	   -9
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12
#define  SWIG_NullReferenceError   -13



/* Compatibility macros for Python 3 */
#if PY_VERSION_HEX >= 0x03000000

#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
#define PyInt_Check(x) PyLong_Check(x)
#define PyInt_AsLong(x) PyLong_AsLong(x)
#define PyInt_FromLong(x) PyLong_FromLong(x)
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
#define PyString_Check(name) PyBytes_Check(name)
#define PyString_FromString(x) PyUnicode_FromString(x)
#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
#define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str)	
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)

#endif

#ifndef Py_TYPE
#  define Py_TYPE(op) ((op)->ob_type)
#endif

/* SWIG APIs for compatibility of both Python 2 & 3 */

#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
#else
#  define SWIG_Python_str_FromFormat PyString_FromFormat
#endif


/* Warning: This function will allocate a new string in Python 3,
 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
 */
SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str)
{
#if PY_VERSION_HEX >= 0x03000000
  char *cstr;
  char *newstr;
  Py_ssize_t len;
  str = PyUnicode_AsUTF8String(str);
  PyBytes_AsStringAndSize(str, &cstr, &len);
  newstr = (char *) malloc(len+1);
  memcpy(newstr, cstr, len+1);
  Py_XDECREF(str);
  return newstr;
#else
  return PyString_AsString(str);
#endif
}

#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
#else
#  define SWIG_Python_str_DelForPy3(x) 
#endif


SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char *c)
{
#if PY_VERSION_HEX >= 0x03000000
  return PyUnicode_FromString(c); 
#else
  return PyString_FromString(c);
#endif
}

/* Add PyOS_snprintf for old Pythons */
#if PY_VERSION_HEX < 0x02020000
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
#  define PyOS_snprintf _snprintf
# else
#  define PyOS_snprintf snprintf
# endif
#endif

/* A crude PyString_FromFormat implementation for old Pythons */
#if PY_VERSION_HEX < 0x02020000

#ifndef SWIG_PYBUFFER_SIZE
# define SWIG_PYBUFFER_SIZE 1024
#endif

static PyObject *
PyString_FromFormat(const char *fmt, ...) {
  va_list ap;
  char buf[SWIG_PYBUFFER_SIZE * 2];
  int res;
  va_start(ap, fmt);
  res = vsnprintf(buf, sizeof(buf), fmt, ap);
  va_end(ap);
  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
}
#endif

/* Add PyObject_Del for old Pythons */
#if PY_VERSION_HEX < 0x01060000
# define PyObject_Del(op) PyMem_DEL((op))
#endif
#ifndef PyObject_DEL
# define PyObject_DEL PyObject_Del
#endif

/* A crude PyExc_StopIteration exception for old Pythons */
#if PY_VERSION_HEX < 0x02020000
# ifndef PyExc_StopIteration
#  define PyExc_StopIteration PyExc_RuntimeError
# endif
# ifndef PyObject_GenericGetAttr
#  define PyObject_GenericGetAttr 0
# endif
#endif

/* Py_NotImplemented is defined in 2.1 and up. */
#if PY_VERSION_HEX < 0x02010000
# ifndef Py_NotImplemented
#  define Py_NotImplemented PyExc_RuntimeError
# endif
#endif

/* A crude PyString_AsStringAndSize implementation for old Pythons */
#if PY_VERSION_HEX < 0x02010000
# ifndef PyString_AsStringAndSize
#  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
# endif
#endif

/* PySequence_Size for old Pythons */
#if PY_VERSION_HEX < 0x02000000
# ifndef PySequence_Size
#  define PySequence_Size PySequence_Length
# endif
#endif

/* PyBool_FromLong for old Pythons */
#if PY_VERSION_HEX < 0x02030000
static
PyObject *PyBool_FromLong(long ok)
{
  PyObject *result = ok ? Py_True : Py_False;
  Py_INCREF(result);
  return result;
}
#endif

/* Py_ssize_t for old Pythons */
/* This code is as recommended by: */
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
typedef inquiry lenfunc;
typedef intargfunc ssizeargfunc;
typedef intintargfunc ssizessizeargfunc;
typedef intobjargproc ssizeobjargproc;
typedef intintobjargproc ssizessizeobjargproc;
typedef getreadbufferproc readbufferproc;
typedef getwritebufferproc writebufferproc;
typedef getsegcountproc segcountproc;
typedef getcharbufferproc charbufferproc;
static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
{
  long result = 0;
  PyObject *i = PyNumber_Int(x);
  if (i) {
    result = PyInt_AsLong(i);
    Py_DECREF(i);
  }
  return result;
}
#endif

#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif

#if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op)				\
  do { 						\
    if (op) {					\
      int vret = visit((op), arg);		\
      if (vret)					\
        return vret;				\
    }						\
  } while (0)
#endif

#if PY_VERSION_HEX < 0x02030000
typedef struct {
  PyTypeObject type;
  PyNumberMethods as_number;
  PyMappingMethods as_mapping;
  PySequenceMethods as_sequence;
  PyBufferProcs as_buffer;
  PyObject *name, *slots;
} PyHeapTypeObject;
#endif

#if PY_VERSION_HEX < 0x02030000
typedef destructor freefunc;
#endif

#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
     (PY_MAJOR_VERSION > 3))
# define SWIGPY_USE_CAPSULE
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
#endif

#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#endif

/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */

SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code) {
  PyObject* type = 0;
  switch(code) {
  case SWIG_MemoryError:
    type = PyExc_MemoryError;
    break;
  case SWIG_IOError:
    type = PyExc_IOError;
    break;
  case SWIG_RuntimeError:
    type = PyExc_RuntimeError;
    break;
  case SWIG_IndexError:
    type = PyExc_IndexError;
    break;
  case SWIG_TypeError:
    type = PyExc_TypeError;
    break;
  case SWIG_DivisionByZero:
    type = PyExc_ZeroDivisionError;
    break;
  case SWIG_OverflowError:
    type = PyExc_OverflowError;
    break;
  case SWIG_SyntaxError:
    type = PyExc_SyntaxError;
    break;
  case SWIG_ValueError:
    type = PyExc_ValueError;
    break;
  case SWIG_SystemError:
    type = PyExc_SystemError;
    break;
  case SWIG_AttributeError:
    type = PyExc_AttributeError;
    break;
  default:
    type = PyExc_RuntimeError;
  }
  return type;
}


SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char* mesg)
{
  PyObject *type = 0;
  PyObject *value = 0;
  PyObject *traceback = 0;

  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
  if (value) {
    char *tmp;
    PyObject *old_str = PyObject_Str(value);
    PyErr_Clear();
    Py_XINCREF(type);

    PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
    SWIG_Python_str_DelForPy3(tmp);
    Py_DECREF(old_str);
    Py_DECREF(value);
  } else {
    PyErr_SetString(PyExc_RuntimeError, mesg);
  }
}

#if defined(SWIG_PYTHON_NO_THREADS)
#  if defined(SWIG_PYTHON_THREADS)
#    undef SWIG_PYTHON_THREADS
#  endif
#endif
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
#      define SWIG_PYTHON_USE_GIL
#    endif
#  endif
#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
#    endif
#    ifdef __cplusplus /* C++ code */
       class SWIG_Python_Thread_Block {
         bool status;
         PyGILState_STATE state;
       public:
         void end() { if (status) { PyGILState_Release(state); status = false;} }
         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
         ~SWIG_Python_Thread_Block() { end(); }
       };
       class SWIG_Python_Thread_Allow {
         bool status;
         PyThreadState *save;
       public:
         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
         ~SWIG_Python_Thread_Allow() { end(); }
       };
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
#    else /* C code */
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
#    endif
#  else /* Old thread way, not implemented, user must provide it */
#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
#      define SWIG_PYTHON_INITIALIZE_THREADS
#    endif
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#    endif
#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
#      define SWIG_PYTHON_THREAD_END_BLOCK
#    endif
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
#    endif
#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
#      define SWIG_PYTHON_THREAD_END_ALLOW
#    endif
#  endif
#else /* No thread support */
#  define SWIG_PYTHON_INITIALIZE_THREADS
#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#  define SWIG_PYTHON_THREAD_END_BLOCK
#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
#  define SWIG_PYTHON_THREAD_END_ALLOW
#endif

/* -----------------------------------------------------------------------------
 * Python API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

/* -----------------------------------------------------------------------------
 * Constant declarations
 * ----------------------------------------------------------------------------- */

/* Constant Types */
#define SWIG_PY_POINTER 4
#define SWIG_PY_BINARY  5

/* 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;


/* -----------------------------------------------------------------------------
 * Wrapper of PyInstanceMethod_New() used in Python 3
 * It is exported to the generated module, used for -fastproxy
 * ----------------------------------------------------------------------------- */
#if PY_VERSION_HEX >= 0x03000000
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
{
  return PyInstanceMethod_New(func);
}
#else
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
{
  return NULL;
}
#endif

#ifdef __cplusplus
}
#endif


/* -----------------------------------------------------------------------------
 * pyrun.swg
 *
 * This file contains the runtime support for Python modules
 * and includes code for managing global variables and pointer
 * type checking.
 *
 * ----------------------------------------------------------------------------- */

/* Common SWIG API */

/* for raw pointers */
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)

#ifdef SWIGPYTHON_BUILTIN
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
#else
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#endif

#define SWIG_InternalNewPointerObj(ptr, type, flags)	SWIG_Python_NewPointerObj(NULL, ptr, type, flags)

#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
#define swig_owntype                                    int

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)


/* Runtime API */

#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)

#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
#define SWIG_fail                        		goto fail					   


/* Runtime API implementation */

/* Error manipulation */

SWIGINTERN void 
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
  PyErr_SetObject(errtype, obj);
  Py_DECREF(obj);
  SWIG_PYTHON_THREAD_END_BLOCK;
}

SWIGINTERN void 
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
  PyErr_SetString(errtype, msg);
  SWIG_PYTHON_THREAD_END_BLOCK;
}

#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)

/* Set a constant value */

#if defined(SWIGPYTHON_BUILTIN)

SWIGINTERN void
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
  PyObject *s = PyString_InternFromString(key);
  PyList_Append(seq, s);
  Py_DECREF(s);
}

SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {   
#if PY_VERSION_HEX < 0x02030000
  PyDict_SetItemString(d, (char *)name, obj);
#else
  PyDict_SetItemString(d, name, obj);
#endif
  Py_DECREF(obj);
  if (public_interface)
    SwigPyBuiltin_AddPublicSymbol(public_interface, name);
}

#else

SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
#if PY_VERSION_HEX < 0x02030000
  PyDict_SetItemString(d, (char *)name, obj);
#else
  PyDict_SetItemString(d, name, obj);
#endif
  Py_DECREF(obj);                            
}

#endif

/* Append a value to the result obj */

SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
  if (!result) {
    result = obj;
  } else if (result == Py_None) {
    Py_DECREF(result);
    result = obj;
  } else {
    if (!PyList_Check(result)) {
      PyObject *o2 = result;
      result = PyList_New(1);
      PyList_SetItem(result, 0, o2);
    }
    PyList_Append(result,obj);
    Py_DECREF(obj);
  }
  return result;
#else
  PyObject*   o2;
  PyObject*   o3;
  if (!result) {
    result = obj;
  } else if (result == Py_None) {
    Py_DECREF(result);
    result = obj;
  } else {
    if (!PyTuple_Check(result)) {
      o2 = result;
      result = PyTuple_New(1);
      PyTuple_SET_ITEM(result, 0, o2);
    }
    o3 = PyTuple_New(1);
    PyTuple_SET_ITEM(o3, 0, obj);
    o2 = result;
    result = PySequence_Concat(o2, o3);
    Py_DECREF(o2);
    Py_DECREF(o3);
  }
  return result;
#endif
}

/* Unpack the argument tuple */

SWIGINTERN int
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
  if (!args) {
    if (!min && !max) {
      return 1;
    } else {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
		   name, (min == max ? "" : "at least "), (int)min);
      return 0;
    }
  }  
  if (!PyTuple_Check(args)) {
    if (min <= 1 && max >= 1) {
      int i;
      objs[0] = args;
      for (i = 1; i < max; ++i) {
	objs[i] = 0;
      }
      return 2;
    }
    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
    return 0;
  } else {
    Py_ssize_t l = PyTuple_GET_SIZE(args);
    if (l < min) {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
		   name, (min == max ? "" : "at least "), (int)min, (int)l);
      return 0;
    } else if (l > max) {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
		   name, (min == max ? "" : "at most "), (int)max, (int)l);
      return 0;
    } else {
      int i;
      for (i = 0; i < l; ++i) {
	objs[i] = PyTuple_GET_ITEM(args, i);
      }
      for (; l < max; ++l) {
	objs[l] = 0;
      }
      return i + 1;
    }    
  }
}

/* A functor is a function object with one single object argument */
#if PY_VERSION_HEX >= 0x02020000
#define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunctionObjArgs(functor, obj, NULL);
#else
#define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunction(functor, "O", obj);
#endif

/*
  Helper for static pointer initialization for both C and C++ code, for example
  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
*/
#ifdef __cplusplus
#define SWIG_STATIC_POINTER(var)  var
#else
#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
#endif

/* -----------------------------------------------------------------------------
 * Pointer declarations
 * ----------------------------------------------------------------------------- */

/* Flags for new pointer objects */
#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)

#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)

#define SWIG_BUILTIN_TP_INIT	    (SWIG_POINTER_OWN << 2)
#define SWIG_BUILTIN_INIT	    (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)

#ifdef __cplusplus
extern "C" {
#endif

/*  How to access Py_None */
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#  ifndef SWIG_PYTHON_NO_BUILD_NONE
#    ifndef SWIG_PYTHON_BUILD_NONE
#      define SWIG_PYTHON_BUILD_NONE
#    endif
#  endif
#endif

#ifdef SWIG_PYTHON_BUILD_NONE
#  ifdef Py_None
#   undef Py_None
#   define Py_None SWIG_Py_None()
#  endif
SWIGRUNTIMEINLINE PyObject * 
_SWIG_Py_None(void)
{
  PyObject *none = Py_BuildValue((char*)"");
  Py_DECREF(none);
  return none;
}
SWIGRUNTIME PyObject * 
SWIG_Py_None(void)
{
  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
  return none;
}
#endif

/* The python void return value */

SWIGRUNTIMEINLINE PyObject * 
SWIG_Py_Void(void)
{
  PyObject *none = Py_None;
  Py_INCREF(none);
  return none;
}

/* SwigPyClientData */

typedef struct {
  PyObject *klass;
  PyObject *newraw;
  PyObject *newargs;
  PyObject *destroy;
  int delargs;
  int implicitconv;
  PyTypeObject *pytype;
} SwigPyClientData;

SWIGRUNTIMEINLINE int 
SWIG_Python_CheckImplicit(swig_type_info *ty)
{
  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
  return data ? data->implicitconv : 0;
}

SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info *desc) {
  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
  PyObject *klass = data ? data->klass : 0;
  return (klass ? klass : PyExc_RuntimeError);
}


SWIGRUNTIME SwigPyClientData * 
SwigPyClientData_New(PyObject* obj)
{
  if (!obj) {
    return 0;
  } else {
    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
    /* the klass element */
    data->klass = obj;
    Py_INCREF(data->klass);
    /* the newraw method and newargs arguments used to create a new raw instance */
    if (PyClass_Check(obj)) {
      data->newraw = 0;
      data->newargs = obj;
      Py_INCREF(obj);
    } else {
#if (PY_VERSION_HEX < 0x02020000)
      data->newraw = 0;
#else
      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
#endif
      if (data->newraw) {
	Py_INCREF(data->newraw);
	data->newargs = PyTuple_New(1);
	PyTuple_SetItem(data->newargs, 0, obj);
      } else {
	data->newargs = obj;
      }
      Py_INCREF(data->newargs);
    }
    /* the destroy method, aka as the C++ delete method */
    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
    if (PyErr_Occurred()) {
      PyErr_Clear();
      data->destroy = 0;
    }
    if (data->destroy) {
      int flags;
      Py_INCREF(data->destroy);
      flags = PyCFunction_GET_FLAGS(data->destroy);
#ifdef METH_O
      data->delargs = !(flags & (METH_O));
#else
      data->delargs = 0;
#endif
    } else {
      data->delargs = 0;
    }
    data->implicitconv = 0;
    data->pytype = 0;
    return data;
  }
}

SWIGRUNTIME void 
SwigPyClientData_Del(SwigPyClientData *data) {
  Py_XDECREF(data->newraw);
  Py_XDECREF(data->newargs);
  Py_XDECREF(data->destroy);
}

/* =============== SwigPyObject =====================*/

typedef struct {
  PyObject_HEAD
  void *ptr;
  swig_type_info *ty;
  int own;
  PyObject *next;
#ifdef SWIGPYTHON_BUILTIN
  PyObject *dict;
#endif
} SwigPyObject;

SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject *v)
{
  return PyLong_FromVoidPtr(v->ptr);
}

SWIGRUNTIME PyObject *
SwigPyObject_format(const char* fmt, SwigPyObject *v)
{
  PyObject *res = NULL;
  PyObject *args = PyTuple_New(1);
  if (args) {
    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
      if (ofmt) {
#if PY_VERSION_HEX >= 0x03000000
	res = PyUnicode_Format(ofmt,args);
#else
	res = PyString_Format(ofmt,args);
#endif
	Py_DECREF(ofmt);
      }
      Py_DECREF(args);
    }
  }
  return res;
}

SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject *v)
{
  return SwigPyObject_format("%o",v);
}

SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject *v)
{
  return SwigPyObject_format("%x",v);
}

SWIGRUNTIME PyObject *
#ifdef METH_NOARGS
SwigPyObject_repr(SwigPyObject *v)
#else
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
#endif
{
  const char *name = SWIG_TypePrettyName(v->ty);
  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
  if (v->next) {
# ifdef METH_NOARGS
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
# else
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
# endif
# if PY_VERSION_HEX >= 0x03000000
    PyObject *joined = PyUnicode_Concat(repr, nrep);
    Py_DecRef(repr);
    Py_DecRef(nrep);
    repr = joined;
# else
    PyString_ConcatAndDel(&repr,nrep);
# endif
  }
  return repr;  
}

SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{
  void *i = v->ptr;
  void *j = w->ptr;
  return (i < j) ? -1 : ((i > j) ? 1 : 0);
}

/* Added for Python 3.x, would it also be useful for Python 2.x? */
SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
{
  PyObject* res;
  if( op != Py_EQ && op != Py_NE ) {
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
  }
  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
  return res;  
}


SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);

#ifdef SWIGPYTHON_BUILTIN
static swig_type_info *SwigPyObject_stype = 0;
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
    SwigPyClientData *cd;
    assert(SwigPyObject_stype);
    cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
    assert(cd);
    assert(cd->pytype);
    return cd->pytype;
}
#else
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
  return type;
}
#endif

SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject *op) {
#ifdef SWIGPYTHON_BUILTIN
  PyTypeObject *target_tp = SwigPyObject_type();
  if (PyType_IsSubtype(op->ob_type, target_tp))
    return 1;
  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
#else
  return (Py_TYPE(op) == SwigPyObject_type())
    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
#endif
}

SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);

SWIGRUNTIME void
SwigPyObject_dealloc(PyObject *v)
{
  SwigPyObject *sobj = (SwigPyObject *) v;
  PyObject *next = sobj->next;
  if (sobj->own == SWIG_POINTER_OWN) {
    swig_type_info *ty = sobj->ty;
    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
    PyObject *destroy = data ? data->destroy : 0;
    if (destroy) {
      /* destroy is always a VARARGS method */
      PyObject *res;
      if (data->delargs) {
	/* we need to create a temporary object to carry the destroy operation */
	PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
	res = SWIG_Python_CallFunctor(destroy, tmp);
	Py_DECREF(tmp);
      } else {
	PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
	PyObject *mself = PyCFunction_GET_SELF(destroy);
	res = ((*meth)(mself, v));
      }
      Py_XDECREF(res);
    } 
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
    else {
      const char *name = SWIG_TypePrettyName(ty);
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
    }
#endif
  } 
  Py_XDECREF(next);
  PyObject_DEL(v);
}

SWIGRUNTIME PyObject* 
SwigPyObject_append(PyObject* v, PyObject* next)
{
  SwigPyObject *sobj = (SwigPyObject *) v;
#ifndef METH_O
  PyObject *tmp = 0;
  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
  next = tmp;
#endif
  if (!SwigPyObject_Check(next)) {
    return NULL;
  }
  sobj->next = next;
  Py_INCREF(next);
  return SWIG_Py_Void();
}

SWIGRUNTIME PyObject* 
#ifdef METH_NOARGS
SwigPyObject_next(PyObject* v)
#else
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
  SwigPyObject *sobj = (SwigPyObject *) v;
  if (sobj->next) {    
    Py_INCREF(sobj->next);
    return sobj->next;
  } else {
    return SWIG_Py_Void();
  }
}

SWIGINTERN PyObject*
#ifdef METH_NOARGS
SwigPyObject_disown(PyObject *v)
#else
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
  SwigPyObject *sobj = (SwigPyObject *)v;
  sobj->own = 0;
  return SWIG_Py_Void();
}

SWIGINTERN PyObject*
#ifdef METH_NOARGS
SwigPyObject_acquire(PyObject *v)
#else
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
  SwigPyObject *sobj = (SwigPyObject *)v;
  sobj->own = SWIG_POINTER_OWN;
  return SWIG_Py_Void();
}

SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args)
{
  PyObject *val = 0;
#if (PY_VERSION_HEX < 0x02020000)
  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
#elif (PY_VERSION_HEX < 0x02050000)
  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
#else
  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) 
#endif
    {
      return NULL;
    } 
  else
    {
      SwigPyObject *sobj = (SwigPyObject *)v;
      PyObject *obj = PyBool_FromLong(sobj->own);
      if (val) {
#ifdef METH_NOARGS
	if (PyObject_IsTrue(val)) {
	  SwigPyObject_acquire(v);
	} else {
	  SwigPyObject_disown(v);
	}
#else
	if (PyObject_IsTrue(val)) {
	  SwigPyObject_acquire(v,args);
	} else {
	  SwigPyObject_disown(v,args);
	}
#endif
      } 
      return obj;
    }
}

#ifdef METH_O
static PyMethodDef
swigobject_methods[] = {
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"acquires ownership of the pointer"},
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
  {0, 0, 0, 0}  
};
#else
static PyMethodDef
swigobject_methods[] = {
  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
  {0, 0, 0, 0}  
};
#endif

#if PY_VERSION_HEX < 0x02020000
SWIGINTERN PyObject *
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
{
  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
}
#endif

SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void) {
  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";

  static PyNumberMethods SwigPyObject_as_number = {
    (binaryfunc)0, /*nb_add*/
    (binaryfunc)0, /*nb_subtract*/
    (binaryfunc)0, /*nb_multiply*/
    /* nb_divide removed in Python 3 */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc)0, /*nb_divide*/
#endif
    (binaryfunc)0, /*nb_remainder*/
    (binaryfunc)0, /*nb_divmod*/
    (ternaryfunc)0,/*nb_power*/
    (unaryfunc)0,  /*nb_negative*/
    (unaryfunc)0,  /*nb_positive*/
    (unaryfunc)0,  /*nb_absolute*/
    (inquiry)0,    /*nb_nonzero*/
    0,		   /*nb_invert*/
    0,		   /*nb_lshift*/
    0,		   /*nb_rshift*/
    0,		   /*nb_and*/
    0,		   /*nb_xor*/
    0,		   /*nb_or*/
#if PY_VERSION_HEX < 0x03000000
    0,   /*nb_coerce*/
#endif
    (unaryfunc)SwigPyObject_long, /*nb_int*/
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc)SwigPyObject_long, /*nb_long*/
#else
    0, /*nb_reserved*/
#endif
    (unaryfunc)0,                 /*nb_float*/
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
#endif
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
  };

  static PyTypeObject swigpyobject_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
      /* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000
      PyVarObject_HEAD_INIT(NULL, 0)
#else
      PyObject_HEAD_INIT(NULL)
      0,                                    /* ob_size */
#endif
      (char *)"SwigPyObject",               /* tp_name */
      sizeof(SwigPyObject),                 /* tp_basicsize */
      0,                                    /* tp_itemsize */
      (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
      0,				    /* tp_print */
#if PY_VERSION_HEX < 0x02020000
      (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
#else
      (getattrfunc)0,                       /* tp_getattr */
#endif
      (setattrfunc)0,                       /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
#else
      (cmpfunc)SwigPyObject_compare,        /* tp_compare */
#endif
      (reprfunc)SwigPyObject_repr,          /* tp_repr */
      &SwigPyObject_as_number,              /* tp_as_number */
      0,                                    /* tp_as_sequence */
      0,                                    /* tp_as_mapping */
      (hashfunc)0,                          /* tp_hash */
      (ternaryfunc)0,                       /* tp_call */
      0,				    /* tp_str */
      PyObject_GenericGetAttr,              /* tp_getattro */
      0,                                    /* tp_setattro */
      0,                                    /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
      swigobject_doc,                       /* tp_doc */
      0,                                    /* tp_traverse */
      0,                                    /* tp_clear */
      (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
      0,                                    /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
      0,                                    /* tp_iter */
      0,                                    /* tp_iternext */
      swigobject_methods,                   /* tp_methods */
      0,                                    /* tp_members */
      0,                                    /* tp_getset */
      0,                                    /* tp_base */
      0,                                    /* tp_dict */
      0,                                    /* tp_descr_get */
      0,                                    /* tp_descr_set */
      0,                                    /* tp_dictoffset */
      0,                                    /* tp_init */
      0,                                    /* tp_alloc */
      0,                                    /* tp_new */
      0,                                    /* tp_free */
      0,                                    /* tp_is_gc */
      0,                                    /* tp_bases */
      0,                                    /* tp_mro */
      0,                                    /* tp_cache */
      0,                                    /* tp_subclasses */
      0,                                    /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
      0,                                    /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
      0,                                    /* tp_version */
#endif
#ifdef COUNT_ALLOCS
      0,0,0,0                               /* tp_alloc -> tp_next */
#endif
    };
    swigpyobject_type = tmp;
    type_init = 1;
#if PY_VERSION_HEX < 0x02020000
    swigpyobject_type.ob_type = &PyType_Type;
#else
    if (PyType_Ready(&swigpyobject_type) < 0)
      return NULL;
#endif
  }
  return &swigpyobject_type;
}

SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
{
  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
  if (sobj) {
    sobj->ptr  = ptr;
    sobj->ty   = ty;
    sobj->own  = own;
    sobj->next = 0;
  }
  return (PyObject *)sobj;
}

/* -----------------------------------------------------------------------------
 * Implements a simple Swig Packed type, and use it instead of string
 * ----------------------------------------------------------------------------- */

typedef struct {
  PyObject_HEAD
  void *pack;
  swig_type_info *ty;
  size_t size;
} SwigPyPacked;

SWIGRUNTIME int
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
{
  char result[SWIG_BUFFER_SIZE];
  fputs("<Swig Packed ", fp); 
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
    fputs("at ", fp); 
    fputs(result, fp); 
  }
  fputs(v->ty->name,fp); 
  fputs(">", fp);
  return 0; 
}
  
SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked *v)
{
  char result[SWIG_BUFFER_SIZE];
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
  } else {
    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
  }  
}

SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked *v)
{
  char result[SWIG_BUFFER_SIZE];
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
  } else {
    return SWIG_Python_str_FromChar(v->ty->name);
  }  
}

SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
{
  size_t i = v->size;
  size_t j = w->size;
  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
}

SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);

SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void) {
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
  return type;
}

SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject *op) {
  return ((op)->ob_type == SwigPyPacked_TypeOnce()) 
    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
}

SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject *v)
{
  if (SwigPyPacked_Check(v)) {
    SwigPyPacked *sobj = (SwigPyPacked *) v;
    free(sobj->pack);
  }
  PyObject_DEL(v);
}

SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void) {
  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
  static PyTypeObject swigpypacked_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
      /* PyObject header changed in Python 3 */
#if PY_VERSION_HEX>=0x03000000
      PyVarObject_HEAD_INIT(NULL, 0)
#else
      PyObject_HEAD_INIT(NULL)
      0,                                    /* ob_size */
#endif
      (char *)"SwigPyPacked",               /* tp_name */
      sizeof(SwigPyPacked),                 /* tp_basicsize */
      0,                                    /* tp_itemsize */
      (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
      (printfunc)SwigPyPacked_print,        /* tp_print */
      (getattrfunc)0,                       /* tp_getattr */
      (setattrfunc)0,                       /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000
      0, /* tp_reserved in 3.0.1 */
#else
      (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
#endif
      (reprfunc)SwigPyPacked_repr,          /* tp_repr */
      0,                                    /* tp_as_number */
      0,                                    /* tp_as_sequence */
      0,                                    /* tp_as_mapping */
      (hashfunc)0,                          /* tp_hash */
      (ternaryfunc)0,                       /* tp_call */
      (reprfunc)SwigPyPacked_str,           /* tp_str */
      PyObject_GenericGetAttr,              /* tp_getattro */
      0,                                    /* tp_setattro */
      0,                                    /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
      swigpacked_doc,                       /* tp_doc */
      0,                                    /* tp_traverse */
      0,                                    /* tp_clear */
      0,                                    /* tp_richcompare */
      0,                                    /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
      0,                                    /* tp_iter */
      0,                                    /* tp_iternext */
      0,                                    /* tp_methods */
      0,                                    /* tp_members */
      0,                                    /* tp_getset */
      0,                                    /* tp_base */
      0,                                    /* tp_dict */
      0,                                    /* tp_descr_get */
      0,                                    /* tp_descr_set */
      0,                                    /* tp_dictoffset */
      0,                                    /* tp_init */
      0,                                    /* tp_alloc */
      0,                                    /* tp_new */
      0,                                    /* tp_free */
      0,                                    /* tp_is_gc */
      0,                                    /* tp_bases */
      0,                                    /* tp_mro */
      0,                                    /* tp_cache */
      0,                                    /* tp_subclasses */
      0,                                    /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
      0,                                    /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
      0,                                    /* tp_version */
#endif
#ifdef COUNT_ALLOCS
      0,0,0,0                               /* tp_alloc -> tp_next */
#endif
    };
    swigpypacked_type = tmp;
    type_init = 1;
#if PY_VERSION_HEX < 0x02020000
    swigpypacked_type.ob_type = &PyType_Type;
#else
    if (PyType_Ready(&swigpypacked_type) < 0)
      return NULL;
#endif
  }
  return &swigpypacked_type;
}

SWIGRUNTIME PyObject *
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
{
  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
  if (sobj) {
    void *pack = malloc(size);
    if (pack) {
      memcpy(pack, ptr, size);
      sobj->pack = pack;
      sobj->ty   = ty;
      sobj->size = size;
    } else {
      PyObject_DEL((PyObject *) sobj);
      sobj = 0;
    }
  }
  return (PyObject *) sobj;
}

SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
{
  if (SwigPyPacked_Check(obj)) {
    SwigPyPacked *sobj = (SwigPyPacked *)obj;
    if (sobj->size != size) return 0;
    memcpy(ptr, sobj->pack, size);
    return sobj->ty;
  } else {
    return 0;
  }
}

/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

SWIGRUNTIMEINLINE PyObject *
_SWIG_This(void)
{
    return SWIG_Python_str_FromChar("this");
}

static PyObject *swig_this = NULL;

SWIGRUNTIME PyObject *
SWIG_This(void)
{
  if (swig_this == NULL)
    swig_this = _SWIG_This();
  return swig_this;
}

/* #define SWIG_PYTHON_SLOW_GETSET_THIS */

/* TODO: I don't know how to implement the fast getset in Python 3 right now */
#if PY_VERSION_HEX>=0x03000000
#define SWIG_PYTHON_SLOW_GETSET_THIS 
#endif

SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject *pyobj) 
{
  PyObject *obj;

  if (SwigPyObject_Check(pyobj))
    return (SwigPyObject *) pyobj;

#ifdef SWIGPYTHON_BUILTIN
  (void)obj;
# ifdef PyWeakref_CheckProxy
  if (PyWeakref_CheckProxy(pyobj)) {
    pyobj = PyWeakref_GET_OBJECT(pyobj);
    if (pyobj && SwigPyObject_Check(pyobj))
      return (SwigPyObject*) pyobj;
  }
# endif
  return NULL;
#else

  obj = 0;

#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
  if (PyInstance_Check(pyobj)) {
    obj = _PyInstance_Lookup(pyobj, SWIG_This());      
  } else {
    PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
    if (dictptr != NULL) {
      PyObject *dict = *dictptr;
      obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
    } else {
#ifdef PyWeakref_CheckProxy
      if (PyWeakref_CheckProxy(pyobj)) {
	PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
	return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
      }
#endif
      obj = PyObject_GetAttr(pyobj,SWIG_This());
      if (obj) {
	Py_DECREF(obj);
      } else {
	if (PyErr_Occurred()) PyErr_Clear();
	return 0;
      }
    }
  }
#else
  obj = PyObject_GetAttr(pyobj,SWIG_This());
  if (obj) {
    Py_DECREF(obj);
  } else {
    if (PyErr_Occurred()) PyErr_Clear();
    return 0;
  }
#endif
  if (obj && !SwigPyObject_Check(obj)) {
    /* a PyObject is called 'this', try to get the 'real this'
       SwigPyObject from it */ 
    return SWIG_Python_GetSwigThis(obj);
  }
  return (SwigPyObject *)obj;
#endif
}

/* Acquire a pointer value */

SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
  if (own == SWIG_POINTER_OWN) {
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
    if (sobj) {
      int oldown = sobj->own;
      sobj->own = own;
      return oldown;
    }
  }
  return 0;
}

/* Convert a pointer value */

SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
  int res;
  SwigPyObject *sobj;
  int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;

  if (!obj)
    return SWIG_ERROR;
  if (obj == Py_None && !implicit_conv) {
    if (ptr)
      *ptr = 0;
    return SWIG_OK;
  }

  res = SWIG_ERROR;

  sobj = SWIG_Python_GetSwigThis(obj);
  if (own)
    *own = 0;
  while (sobj) {
    void *vptr = sobj->ptr;
    if (ty) {
      swig_type_info *to = sobj->ty;
      if (to == ty) {
        /* no type cast needed */
        if (ptr) *ptr = vptr;
        break;
      } else {
        swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
        if (!tc) {
          sobj = (SwigPyObject *)sobj->next;
        } else {
          if (ptr) {
            int newmemory = 0;
            *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
            if (newmemory == SWIG_CAST_NEW_MEMORY) {
              assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
              if (own)
                *own = *own | SWIG_CAST_NEW_MEMORY;
            }
          }
          break;
        }
      }
    } else {
      if (ptr) *ptr = vptr;
      break;
    }
  }
  if (sobj) {
    if (own)
      *own = *own | sobj->own;
    if (flags & SWIG_POINTER_DISOWN) {
      sobj->own = 0;
    }
    res = SWIG_OK;
  } else {
    if (implicit_conv) {
      SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
      if (data && !data->implicitconv) {
        PyObject *klass = data->klass;
        if (klass) {
          PyObject *impconv;
          data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
          impconv = SWIG_Python_CallFunctor(klass, obj);
          data->implicitconv = 0;
          if (PyErr_Occurred()) {
            PyErr_Clear();
            impconv = 0;
          }
          if (impconv) {
            SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
            if (iobj) {
              void *vptr;
              res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
              if (SWIG_IsOK(res)) {
                if (ptr) {
                  *ptr = vptr;
                  /* transfer the ownership to 'ptr' */
                  iobj->own = 0;
                  res = SWIG_AddCast(res);
                  res = SWIG_AddNewMask(res);
                } else {
                  res = SWIG_AddCast(res);		    
                }
              }
            }
            Py_DECREF(impconv);
          }
        }
      }
    }
    if (!SWIG_IsOK(res) && obj == Py_None) {
      if (ptr)
        *ptr = 0;
      if (PyErr_Occurred())
        PyErr_Clear();
      res = SWIG_OK;
    }
  }
  return res;
}

/* Convert a function ptr value */

SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
  if (!PyCFunction_Check(obj)) {
    return SWIG_ConvertPtr(obj, ptr, ty, 0);
  } else {
    void *vptr = 0;
    
    /* here we get the method pointer for callbacks */
    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
    if (desc)
      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
    if (!desc) 
      return SWIG_ERROR;
    if (ty) {
      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
      if (tc) {
        int newmemory = 0;
        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
        assert(!newmemory); /* newmemory handling not yet implemented */
      } else {
        return SWIG_ERROR;
      }
    } else {
      *ptr = vptr;
    }
    return SWIG_OK;
  }
}

/* Convert a packed value value */

SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
  if (!to) return SWIG_ERROR;
  if (ty) {
    if (to != ty) {
      /* check type cast? */
      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
      if (!tc) return SWIG_ERROR;
    }
  }
  return SWIG_OK;
}  

/* -----------------------------------------------------------------------------
 * Create a new pointer object
 * ----------------------------------------------------------------------------- */

/*
  Create a new instance object, without calling __init__, and set the
  'this' attribute.
*/

SWIGRUNTIME PyObject* 
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
{
#if (PY_VERSION_HEX >= 0x02020000)
  PyObject *inst = 0;
  PyObject *newraw = data->newraw;
  if (newraw) {
    inst = PyObject_Call(newraw, data->newargs, NULL);
    if (inst) {
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
      PyObject **dictptr = _PyObject_GetDictPtr(inst);
      if (dictptr != NULL) {
	PyObject *dict = *dictptr;
	if (dict == NULL) {
	  dict = PyDict_New();
	  *dictptr = dict;
	  PyDict_SetItem(dict, SWIG_This(), swig_this);
	}
      }
#else
      PyObject *key = SWIG_This();
      PyObject_SetAttr(inst, key, swig_this);
#endif
    }
  } else {
#if PY_VERSION_HEX >= 0x03000000
    inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
    if (inst) {
      PyObject_SetAttr(inst, SWIG_This(), swig_this);
      Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
    }
#else
    PyObject *dict = PyDict_New();
    if (dict) {
      PyDict_SetItem(dict, SWIG_This(), swig_this);
      inst = PyInstance_NewRaw(data->newargs, dict);
      Py_DECREF(dict);
    }
#endif
  }
  return inst;
#else
#if (PY_VERSION_HEX >= 0x02010000)
  PyObject *inst = 0;
  PyObject *dict = PyDict_New();
  if (dict) {
    PyDict_SetItem(dict, SWIG_This(), swig_this);
    inst = PyInstance_NewRaw(data->newargs, dict);
    Py_DECREF(dict);
  }
  return (PyObject *) inst;
#else
  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
  if (inst == NULL) {
    return NULL;
  }
  inst->in_class = (PyClassObject *)data->newargs;
  Py_INCREF(inst->in_class);
  inst->in_dict = PyDict_New();
  if (inst->in_dict == NULL) {
    Py_DECREF(inst);
    return NULL;
  }
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
  inst->in_weakreflist = NULL;
#endif
#ifdef Py_TPFLAGS_GC
  PyObject_GC_Init(inst);
#endif
  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
  return (PyObject *) inst;
#endif
#endif
}

SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
{
 PyObject *dict;
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
 PyObject **dictptr = _PyObject_GetDictPtr(inst);
 if (dictptr != NULL) {
   dict = *dictptr;
   if (dict == NULL) {
     dict = PyDict_New();
     *dictptr = dict;
   }
   PyDict_SetItem(dict, SWIG_This(), swig_this);
   return;
 }
#endif
 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
 PyDict_SetItem(dict, SWIG_This(), swig_this);
 Py_DECREF(dict);
} 


SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject *args) {
  PyObject *obj[2];
  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
    return NULL;
  } else {
    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
    if (sthis) {
      SwigPyObject_append((PyObject*) sthis, obj[1]);
    } else {
      SWIG_Python_SetSwigThis(obj[0], obj[1]);
    }
    return SWIG_Py_Void();
  }
}

/* Create a new pointer object */

SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
  SwigPyClientData *clientdata;
  PyObject * robj;
  int own;

  if (!ptr)
    return SWIG_Py_Void();

  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
  if (clientdata && clientdata->pytype) {
    SwigPyObject *newobj;
    if (flags & SWIG_BUILTIN_TP_INIT) {
      newobj = (SwigPyObject*) self;
      if (newobj->ptr) {
        PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
        while (newobj->next)
	  newobj = (SwigPyObject *) newobj->next;
        newobj->next = next_self;
        newobj = (SwigPyObject *)next_self;
      }
    } else {
      newobj = PyObject_New(SwigPyObject, clientdata->pytype);
    }
    if (newobj) {
      newobj->ptr = ptr;
      newobj->ty = type;
      newobj->own = own;
      newobj->next = 0;
#ifdef SWIGPYTHON_BUILTIN
      newobj->dict = 0;
#endif
      return (PyObject*) newobj;
    }
    return SWIG_Py_Void();
  }

  assert(!(flags & SWIG_BUILTIN_TP_INIT));

  robj = SwigPyObject_New(ptr, type, own);
  if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
    PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
    Py_DECREF(robj);
    robj = inst;
  }
  return robj;
}

/* Create a new packed object */

SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
}

/* -----------------------------------------------------------------------------*
 *  Get type list 
 * -----------------------------------------------------------------------------*/

#ifdef SWIG_LINK_RUNTIME
void *SWIG_ReturnGlobalTypeList(void *);
#endif

SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
  static void *type_pointer = (void *)0;
  /* first check if module already created */
  if (!type_pointer) {
#ifdef SWIG_LINK_RUNTIME
    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
#else
# ifdef SWIGPY_USE_CAPSULE
    type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
# else
    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
# endif
    if (PyErr_Occurred()) {
      PyErr_Clear();
      type_pointer = (void *)0;
    }
#endif
  }
  return (swig_module_info *) type_pointer;
}

#if PY_MAJOR_VERSION < 2
/* PyModule_AddObject function was introduced in Python 2.0.  The following function
   is copied out of Python/modsupport.c in python version 2.3.4 */
SWIGINTERN int
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
{
  PyObject *dict;
  if (!PyModule_Check(m)) {
    PyErr_SetString(PyExc_TypeError,
		    "PyModule_AddObject() needs module as first arg");
    return SWIG_ERROR;
  }
  if (!o) {
    PyErr_SetString(PyExc_TypeError,
		    "PyModule_AddObject() needs non-NULL value");
    return SWIG_ERROR;
  }
  
  dict = PyModule_GetDict(m);
  if (dict == NULL) {
    /* Internal error -- modules must have a dict! */
    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
		 PyModule_GetName(m));
    return SWIG_ERROR;
  }
  if (PyDict_SetItemString(dict, name, o))
    return SWIG_ERROR;
  Py_DECREF(o);
  return SWIG_OK;
}
#endif

SWIGRUNTIME void
#ifdef SWIGPY_USE_CAPSULE
SWIG_Python_DestroyModule(PyObject *obj)
#else
SWIG_Python_DestroyModule(void *vptr)
#endif
{
#ifdef SWIGPY_USE_CAPSULE
  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
#else
  swig_module_info *swig_module = (swig_module_info *) vptr;
#endif
  swig_type_info **types = swig_module->types;
  size_t i;
  for (i =0; i < swig_module->size; ++i) {
    swig_type_info *ty = types[i];
    if (ty->owndata) {
      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
      if (data) SwigPyClientData_Del(data);
    }
  }
  Py_DECREF(SWIG_This());
  swig_this = NULL;
}

SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info *swig_module) {
#if PY_VERSION_HEX >= 0x03000000
 /* Add a dummy module object into sys.modules */
  PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
#else
  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
#endif
#ifdef SWIGPY_USE_CAPSULE
  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
  if (pointer && module) {
    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
  } else {
    Py_XDECREF(pointer);
  }
#else
  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
  if (pointer && module) {
    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
  } else {
    Py_XDECREF(pointer);
  }
#endif
}

/* The python cached type query */
SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void) {
  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
  return cache;
}

SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char *type)
{
  PyObject *cache = SWIG_Python_TypeCache();
  PyObject *key = SWIG_Python_str_FromChar(type); 
  PyObject *obj = PyDict_GetItem(cache, key);
  swig_type_info *descriptor;
  if (obj) {
#ifdef SWIGPY_USE_CAPSULE
    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
#else
    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif
  } else {
    swig_module_info *swig_module = SWIG_GetModule(0);
    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
    if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE
      obj = PyCapsule_New((void*) descriptor, NULL, NULL);
#else
      obj = PyCObject_FromVoidPtr(descriptor, NULL);
#endif
      PyDict_SetItem(cache, key, obj);
      Py_DECREF(obj);
    }
  }
  Py_DECREF(key);
  return descriptor;
}

/* 
   For backward compatibility only
*/
#define SWIG_POINTER_EXCEPTION  0
#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)

SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char* mesg, int infront)
{  
  if (PyErr_Occurred()) {
    PyObject *type = 0;
    PyObject *value = 0;
    PyObject *traceback = 0;
    PyErr_Fetch(&type, &value, &traceback);
    if (value) {
      char *tmp;
      PyObject *old_str = PyObject_Str(value);
      Py_XINCREF(type);
      PyErr_Clear();
      if (infront) {
	PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
      } else {
	PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
      }
      SWIG_Python_str_DelForPy3(tmp);
      Py_DECREF(old_str);
    }
    return 1;
  } else {
    return 0;
  }
}
  
SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)
{
  if (PyErr_Occurred()) {
    /* add information about failing argument */
    char mesg[256];
    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
    return SWIG_Python_AddErrMesg(mesg, 1);
  } else {
    return 0;
  }
}

SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject *self)
{
  SwigPyObject *v = (SwigPyObject *)self;
  swig_type_info *ty = v ? v->ty : 0;
  return ty ? ty->str : "";
}

SWIGRUNTIME void
SWIG_Python_TypeError(const char *type, PyObject *obj)
{
  if (type) {
#if defined(SWIG_COBJECT_TYPES)
    if (obj && SwigPyObject_Check(obj)) {
      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
      if (otype) {
	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
		     type, otype);
	return;
      }
    } else 
#endif      
    {
      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
      if (otype) {
	PyObject *str = PyObject_Str(obj);
	const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
	if (cstr) {
	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
		       type, otype, cstr);
          SWIG_Python_str_DelForPy3(cstr);
	} else {
	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
		       type, otype);
	}
	Py_XDECREF(str);
	return;
      }
    }   
    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
  } else {
    PyErr_Format(PyExc_TypeError, "unexpected type is received");
  }
}


/* Convert a pointer value, signal an exception on a type mismatch */
SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
  void *result;
  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
    PyErr_Clear();
#if SWIG_POINTER_EXCEPTION
    if (flags) {
      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
      SWIG_Python_ArgFail(argnum);
    }
#endif
  }
  return result;
}

#ifdef SWIGPYTHON_BUILTIN
SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
  PyTypeObject *tp = obj->ob_type;
  PyObject *descr;
  PyObject *encoded_name;
  descrsetfunc f;
  int res = -1;

# ifdef Py_USING_UNICODE
  if (PyString_Check(name)) {
    name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
    if (!name)
      return -1;
  } else if (!PyUnicode_Check(name))
# else
  if (!PyString_Check(name))
# endif
  {
    PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
    return -1;
  } else {
    Py_INCREF(name);
  }

  if (!tp->tp_dict) {
    if (PyType_Ready(tp) < 0)
      goto done;
  }

  descr = _PyType_Lookup(tp, name);
  f = NULL;
  if (descr != NULL)
    f = descr->ob_type->tp_descr_set;
  if (!f) {
    if (PyString_Check(name)) {
      encoded_name = name;
      Py_INCREF(name);
    } else {
      encoded_name = PyUnicode_AsUTF8String(name);
    }
    PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
    Py_DECREF(encoded_name);
  } else {
    res = f(descr, obj, value);
  }
  
  done:
  Py_DECREF(name);
  return res;
}
#endif


#ifdef __cplusplus
}
#endif



#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



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

#define SWIGTYPE_p_ClaClassifierProto__Builder swig_types[0]
#define SWIGTYPE_p_ClaClassifierProto__Reader swig_types[1]
#define SWIGTYPE_p_ConnectionsProto__Builder swig_types[2]
#define SWIGTYPE_p_ConnectionsProto__Reader swig_types[3]
#define SWIGTYPE_p_ErosionT_float_t swig_types[4]
#define SWIGTYPE_p_IJV swig_types[5]
#define SWIGTYPE_p_InSynapse swig_types[6]
#define SWIGTYPE_p_InSynapses swig_types[7]
#define SWIGTYPE_p_NTA_BasicType swig_types[8]
#define SWIGTYPE_p_NTA_LogLevel swig_types[9]
#define SWIGTYPE_p_OutSynapses swig_types[10]
#define SWIGTYPE_p_Rotation45T_float_t swig_types[11]
#define SWIGTYPE_p_Row swig_types[12]
#define SWIGTYPE_p_SegmentUpdates swig_types[13]
#define SWIGTYPE_p_SeparableConvolution2DT_float_t swig_types[14]
#define SWIGTYPE_p_SpatialPoolerProto__Builder swig_types[15]
#define SWIGTYPE_p_SpatialPoolerProto__Reader swig_types[16]
#define SWIGTYPE_p_allocator_type swig_types[17]
#define SWIGTYPE_p_argument_type swig_types[18]
#define SWIGTYPE_p_char swig_types[19]
#define SWIGTYPE_p_const_iterator swig_types[20]
#define SWIGTYPE_p_difference_type swig_types[21]
#define SWIGTYPE_p_double swig_types[22]
#define SWIGTYPE_p_feature_type swig_types[23]
#define SWIGTYPE_p_first_type swig_types[24]
#define SWIGTYPE_p_float swig_types[25]
#define SWIGTYPE_p_int swig_types[26]
#define SWIGTYPE_p_istream swig_types[27]
#define SWIGTYPE_p_kernel_type swig_types[28]
#define SWIGTYPE_p_key_type swig_types[29]
#define SWIGTYPE_p_label_type swig_types[30]
#define SWIGTYPE_p_long swig_types[31]
#define SWIGTYPE_p_mapped_type swig_types[32]
#define SWIGTYPE_p_nupic__ByteVector swig_types[33]
#define SWIGTYPE_p_nupic__algorithms__Cells4__CState swig_types[34]
#define SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed swig_types[35]
#define SWIGTYPE_p_nupic__algorithms__Cells4__Cell swig_types[36]
#define SWIGTYPE_p_nupic__algorithms__Cells4__Cells4 swig_types[37]
#define SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse swig_types[38]
#define SWIGTYPE_p_nupic__algorithms__Cells4__InSynapseOrder swig_types[39]
#define SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse swig_types[40]
#define SWIGTYPE_p_nupic__algorithms__Cells4__Segment swig_types[41]
#define SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate swig_types[42]
#define SWIGTYPE_p_nupic__algorithms__cla_classifier__ClassifierResult swig_types[43]
#define SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier swig_types[44]
#define SWIGTYPE_p_nupic__algorithms__connections__Activity swig_types[45]
#define SWIGTYPE_p_nupic__algorithms__connections__Cell swig_types[46]
#define SWIGTYPE_p_nupic__algorithms__connections__CellData swig_types[47]
#define SWIGTYPE_p_nupic__algorithms__connections__Connections swig_types[48]
#define SWIGTYPE_p_nupic__algorithms__connections__Segment swig_types[49]
#define SWIGTYPE_p_nupic__algorithms__connections__SegmentData swig_types[50]
#define SWIGTYPE_p_nupic__algorithms__connections__Synapse swig_types[51]
#define SWIGTYPE_p_nupic__algorithms__connections__SynapseData swig_types[52]
#define SWIGTYPE_p_nupic__algorithms__linear__TRON swig_types[53]
#define SWIGTYPE_p_nupic__algorithms__linear__feature_node swig_types[54]
#define SWIGTYPE_p_nupic__algorithms__linear__function swig_types[55]
#define SWIGTYPE_p_nupic__algorithms__linear__linear swig_types[56]
#define SWIGTYPE_p_nupic__algorithms__linear__model swig_types[57]
#define SWIGTYPE_p_nupic__algorithms__linear__parameter swig_types[58]
#define SWIGTYPE_p_nupic__algorithms__linear__problem swig_types[59]
#define SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector swig_types[60]
#define SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler swig_types[61]
#define SWIGTYPE_p_nupic__algorithms__svm__QMatrix swig_types[62]
#define SWIGTYPE_p_nupic__algorithms__svm__QMatrix01 swig_types[63]
#define SWIGTYPE_p_nupic__algorithms__svm__decision_function swig_types[64]
#define SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_float_t swig_types[65]
#define SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_int_t swig_types[66]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_01 swig_types[67]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_01_traits swig_types[68]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_dense swig_types[69]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_model swig_types[70]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_parameter swig_types[71]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_problem swig_types[72]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_problem01 swig_types[73]
#define SWIGTYPE_p_nupic__algorithms__svm__svm_std_traits swig_types[74]
#define SWIGTYPE_p_nz_index_type swig_types[75]
#define SWIGTYPE_p_ostream swig_types[76]
#define SWIGTYPE_p_p_PyObject swig_types[77]
#define SWIGTYPE_p_p_char swig_types[78]
#define SWIGTYPE_p_p_float swig_types[79]
#define SWIGTYPE_p_p_nupic__algorithms__linear__feature_node swig_types[80]
#define SWIGTYPE_p_p_void swig_types[81]
#define SWIGTYPE_p_parent_type swig_types[82]
#define SWIGTYPE_p_prec_value_type swig_types[83]
#define SWIGTYPE_p_problem_type swig_types[84]
#define SWIGTYPE_p_q_matrix_type swig_types[85]
#define SWIGTYPE_p_result_type swig_types[86]
#define SWIGTYPE_p_sample_type swig_types[87]
#define SWIGTYPE_p_second_type swig_types[88]
#define SWIGTYPE_p_self_type swig_types[89]
#define SWIGTYPE_p_short swig_types[90]
#define SWIGTYPE_p_size_t swig_types[91]
#define SWIGTYPE_p_size_type swig_types[92]
#define SWIGTYPE_p_std__allocatorT_char_t swig_types[93]
#define SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Cell_t swig_types[94]
#define SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Segment_t swig_types[95]
#define SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Synapse_t swig_types[96]
#define SWIGTYPE_p_std__allocatorT_size_t_t swig_types[97]
#define SWIGTYPE_p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t swig_types[98]
#define SWIGTYPE_p_std__istream swig_types[99]
#define SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t swig_types[100]
#define SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t swig_types[101]
#define SWIGTYPE_p_std__ostream swig_types[102]
#define SWIGTYPE_p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t swig_types[103]
#define SWIGTYPE_p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t swig_types[104]
#define SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t swig_types[105]
#define SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t swig_types[106]
#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[107]
#define SWIGTYPE_p_std__vectorT_int_p_std__allocatorT_int_p_t_t swig_types[108]
#define SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t swig_types[109]
#define SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t swig_types[110]
#define SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t swig_types[111]
#define SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t swig_types[112]
#define SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t swig_types[113]
#define SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t swig_types[114]
#define SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t swig_types[115]
#define SWIGTYPE_p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t swig_types[116]
#define SWIGTYPE_p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t swig_types[117]
#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[118]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[119]
#define SWIGTYPE_p_uintptr_t swig_types[120]
#define SWIGTYPE_p_unsigned_char swig_types[121]
#define SWIGTYPE_p_unsigned_int swig_types[122]
#define SWIGTYPE_p_unsigned_long swig_types[123]
#define SWIGTYPE_p_unsigned_short swig_types[124]
#define SWIGTYPE_p_value_type swig_types[125]
static swig_type_info *swig_types[127];
static swig_module_info swig_module = {swig_types, 126, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

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

#if (PY_VERSION_HEX <= 0x02000000)
# if !defined(SWIG_PYTHON_CLASSIC)
#  error "This python version requires swig to be run with the '-classic' option"
# endif
#endif
#if (PY_VERSION_HEX <= 0x02020000)
# error "This python version requires swig to be run with the '-nomodern' option"
#endif
#if (PY_VERSION_HEX <= 0x02020000)
# error "This python version requires swig to be run with the '-nomodernargs' option"
#endif
#ifndef METH_O
# error "This python version requires swig to be run with the '-nofastunpack' option"
#endif
#ifdef SWIG_TypeQuery
# undef SWIG_TypeQuery
#endif
#define SWIG_TypeQuery SWIG_Python_TypeQuery

/*-----------------------------------------------
              @(target):= _algorithms.so
  ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_init    PyInit__algorithms

#else
#  define SWIG_init    init_algorithms

#endif
#define SWIG_name    "_algorithms"

#define SWIGVERSION 0x030002 
#define SWIG_VERSION SWIGVERSION


#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 


#include <stdexcept>


namespace swig {
  class SwigPtr_PyObject {
  protected:
    PyObject *_obj;

  public:
    SwigPtr_PyObject() :_obj(0)
    {
    }

    SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj)
    {
      Py_XINCREF(_obj);      
    }
    
    SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
    {
      if (initial_ref) {
        Py_XINCREF(_obj);
      }
    }
    
    SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) 
    {
      Py_XINCREF(item._obj);
      Py_XDECREF(_obj);
      _obj = item._obj;
      return *this;      
    }
    
    ~SwigPtr_PyObject() 
    {
      Py_XDECREF(_obj);
    }
    
    operator PyObject *() const
    {
      return _obj;
    }

    PyObject *operator->() const
    {
      return _obj;
    }
  };
}


namespace swig {
  struct SwigVar_PyObject : SwigPtr_PyObject {
    SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
    
    SwigVar_PyObject & operator = (PyObject* obj)
    {
      Py_XDECREF(_obj);
      _obj = obj;
      return *this;      
    }
  };
}


#include <Python.h>
#include <iostream>

#include "nupic/types/Exception.hpp"
#include "py_support/PyHelpers.hpp"


#include <string>


#include <stddef.h>


namespace swig {
  struct stop_iteration {
  };

  struct SwigPyIterator {
  private:
    SwigPtr_PyObject _seq;

  protected:
    SwigPyIterator(PyObject *seq) : _seq(seq)
    {
    }
      
  public:
    virtual ~SwigPyIterator() {}

    // Access iterator method, required by Python
    virtual PyObject *value() const = 0;

    // Forward iterator method, required by Python
    virtual SwigPyIterator *incr(size_t n = 1) = 0;
    
    // Backward iterator method, very common in C++, but not required in Python
    virtual SwigPyIterator *decr(size_t /*n*/ = 1)
    {
      throw stop_iteration();
    }

    // Random access iterator methods, but not required in Python
    virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const
    {
      throw std::invalid_argument("operation not supported");
    }

    virtual bool equal (const SwigPyIterator &/*x*/) const
    {
      throw std::invalid_argument("operation not supported");
    }
    
    // C++ common/needed methods
    virtual SwigPyIterator *copy() const = 0;

    PyObject *next()     
    {
      SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads       
      PyObject *obj = value();
      incr();       
      SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
      return obj;     
    }

    /* Make an alias for Python 3.x */
    PyObject *__next__()
    {
      return next();
    }

    PyObject *previous()
    {
      SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads       
      decr();
      PyObject *obj = value();
      SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads       
      return obj;
    }

    SwigPyIterator *advance(ptrdiff_t n)
    {
      return  (n > 0) ?  incr(n) : decr(-n);
    }
      
    bool operator == (const SwigPyIterator& x)  const
    {
      return equal(x);
    }
      
    bool operator != (const SwigPyIterator& x) const
    {
      return ! operator==(x);
    }
      
    SwigPyIterator& operator += (ptrdiff_t n)
    {
      return *advance(n);
    }

    SwigPyIterator& operator -= (ptrdiff_t n)
    {
      return *advance(-n);
    }
      
    SwigPyIterator* operator + (ptrdiff_t n) const
    {
      return copy()->advance(n);
    }

    SwigPyIterator* operator - (ptrdiff_t n) const
    {
      return copy()->advance(-n);
    }
      
    ptrdiff_t operator - (const SwigPyIterator& x) const
    {
      return x.distance(*this);
    }
      
    static swig_type_info* descriptor() {
      static int init = 0;
      static swig_type_info* desc = 0;
      if (!init) {
	desc = SWIG_TypeQuery("swig::SwigPyIterator *");
	init = 1;
      }	
      return desc;
    }    
  };

#if defined(SWIGPYTHON_BUILTIN)
  inline PyObject* make_output_iterator_builtin (PyObject *pyself)
  {
    Py_INCREF(pyself);
    return pyself;
  }
#endif
}


#include <algorithm>


namespace swig {  
  template <class Type>
  struct noconst_traits {
    typedef Type noconst_type;
  };

  template <class Type>
  struct noconst_traits<const Type> {
    typedef Type noconst_type;
  };

  /*
    type categories
  */
  struct pointer_category { };  
  struct value_category { };

  /*
    General traits that provides type_name and type_info
  */
  template <class Type> struct traits { };

  template <class Type>
  inline const char* type_name() {
    return traits<typename noconst_traits<Type >::noconst_type >::type_name();
  }

  template <class Type> 
  struct traits_info {
    static swig_type_info *type_query(std::string name) {
      name += " *";
      return SWIG_TypeQuery(name.c_str());
    }    
    static swig_type_info *type_info() {
      static swig_type_info *info = type_query(type_name<Type>());
      return info;
    }
  };

  template <class Type>
  inline swig_type_info *type_info() {
    return traits_info<Type>::type_info();
  }

  /*
    Partial specialization for pointers
  */
  template <class Type> struct traits <Type *> {
    typedef pointer_category category;
    static std::string make_ptr_name(const char* name) {
      std::string ptrname = name;
      ptrname += " *";
      return ptrname;
    }    
    static const char* type_name() {
      static std::string name = make_ptr_name(swig::type_name<Type>());
      return name.c_str();
    }
  };

  template <class Type, class Category> 
  struct traits_as { };
 
  template <class Type, class Category> 
  struct traits_check { };

}


namespace swig {  
  /*
    Traits that provides the from method
  */
  template <class Type> struct traits_from_ptr {
    static PyObject *from(Type *val, int owner = 0) {
      return SWIG_InternalNewPointerObj(val, type_info<Type>(), owner);
    }
  };

  template <class Type> struct traits_from {
    static PyObject *from(const Type& val) {
      return traits_from_ptr<Type>::from(new Type(val), 1);
    }
  };

  template <class Type> struct traits_from<Type *> {
    static PyObject *from(Type* val) {
      return traits_from_ptr<Type>::from(val, 0);
    }
  };

  template <class Type> struct traits_from<const Type *> {
    static PyObject *from(const Type* val) {
      return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0);
    }
  };


  template <class Type>
  inline PyObject *from(const Type& val) {
    return traits_from<Type>::from(val);
  }

  template <class Type>
  inline PyObject *from_ptr(Type* val, int owner) {
    return traits_from_ptr<Type>::from(val, owner);
  }

  /*
    Traits that provides the asval/as/check method
  */
  template <class Type>
  struct traits_asptr {   
    static int asptr(PyObject *obj, Type **val) {
      Type *p;
      int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  }; 

  template <class Type>
  inline int asptr(PyObject *obj, Type **vptr) {
    return traits_asptr<Type>::asptr(obj, vptr);
  }

  template <class Type> 
  struct traits_asval {
    static int asval(PyObject *obj, Type *val) {
      if (val) {
	Type *p = 0;
	int res = traits_asptr<Type>::asptr(obj, &p);
	if (!SWIG_IsOK(res)) return res;	
	if (p) {
	  typedef typename noconst_traits<Type>::noconst_type noconst_type;
	  *(const_cast<noconst_type*>(val)) = *p;
	  if (SWIG_IsNewObj(res)){
	    delete p;
	    res = SWIG_DelNewMask(res);
	  }
	  return res;
	} else {
	  return SWIG_ERROR;
	}
      } else {
	return traits_asptr<Type>::asptr(obj, (Type **)(0));
      }
    }
  };

  template <class Type> struct traits_asval<Type*> {
    static int asval(PyObject *obj, Type **val) {
      if (val) {
        typedef typename noconst_traits<Type>::noconst_type noconst_type;
        noconst_type *p = 0;
        int res = traits_asptr<noconst_type>::asptr(obj,  &p);
        if (SWIG_IsOK(res)) {
          *(const_cast<noconst_type**>(val)) = p;
	}
	return res;
      } else {
	return traits_asptr<Type>::asptr(obj, (Type **)(0));
      }
    }
  };
  
  template <class Type>
  inline int asval(PyObject *obj, Type *val) {
    return traits_asval<Type>::asval(obj, val);
  }

  template <class Type> 
  struct traits_as<Type, value_category> {
    static Type as(PyObject *obj, bool throw_error) {
      Type v;
      int res = asval(obj, &v);
      if (!obj || !SWIG_IsOK(res)) {
	if (!PyErr_Occurred()) {
	  ::SWIG_Error(SWIG_TypeError,  swig::type_name<Type>());
	}
	if (throw_error) throw std::invalid_argument("bad type");
      }
      return v;
    }
  };

  template <class Type> 
  struct traits_as<Type, pointer_category> {
    static Type as(PyObject *obj, bool throw_error) {
      Type *v = 0;      
      int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
      if (SWIG_IsOK(res) && v) {
	if (SWIG_IsNewObj(res)) {
	  Type r(*v);
	  delete v;
	  return r;
	} else {
	  return *v;
	}
      } else {
	// Uninitialized return value, no Type() constructor required.
	static Type *v_def = (Type*) malloc(sizeof(Type));
	if (!PyErr_Occurred()) {
	  SWIG_Error(SWIG_TypeError,  swig::type_name<Type>());
	}
	if (throw_error) throw std::invalid_argument("bad type");
	memset(v_def,0,sizeof(Type));
	return *v_def;
      }
    }
  };

  template <class Type> 
  struct traits_as<Type*, pointer_category> {
    static Type* as(PyObject *obj, bool throw_error) {
      Type *v = 0;      
      int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
      if (SWIG_IsOK(res)) {
	return v;
      } else {
	if (!PyErr_Occurred()) {
	  SWIG_Error(SWIG_TypeError,  swig::type_name<Type>());
	}
	if (throw_error) throw std::invalid_argument("bad type");
	return 0;
      }
    }
  };
    
  template <class Type>
  inline Type as(PyObject *obj, bool te = false) {
    return traits_as<Type, typename traits<Type>::category>::as(obj, te);
  }

  template <class Type> 
  struct traits_check<Type, value_category> {
    static bool check(PyObject *obj) {
      int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
      return SWIG_IsOK(res) ? true : false;
    }
  };

  template <class Type> 
  struct traits_check<Type, pointer_category> {
    static bool check(PyObject *obj) {
      int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
      return SWIG_IsOK(res) ? true : false;
    }
  };

  template <class Type>
  inline bool check(PyObject *obj) {
    return traits_check<Type, typename traits<Type>::category>::check(obj);
  }
}


#include <functional>

namespace std {
  template <>
  struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool>
  {
    bool
    operator()(PyObject * v, PyObject *w) const
    { 
      bool res;
      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
      res = PyObject_RichCompareBool(v, w, Py_LT) ? true : false;
      /* This may fall into a case of inconsistent
               eg. ObjA > ObjX > ObjB
               but ObjA < ObjB
      */
      if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) )
      {
        /* Objects can't be compared, this mostly occurred in Python 3.0 */
        /* Compare their ptr directly for a workaround */
        res = (v < w);
        PyErr_Clear();
      }
      SWIG_PYTHON_THREAD_END_BLOCK;
      return res;
    }
  };

  template <>
  struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
  {
    bool
    operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
    {
      return std::less<PyObject *>()(v, w);
    }
  };

  template <>
  struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
  {
    bool
    operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
    {
      return std::less<PyObject *>()(v, w);
    }
  };

}

namespace swig {
  template <> struct traits<PyObject *> {
    typedef value_category category;
    static const char* type_name() { return "PyObject *"; }
  };  

  template <>  struct traits_asval<PyObject * > {   
    typedef PyObject * value_type;
    static int asval(PyObject *obj, value_type *val) {
      if (val) *val = obj;
      return SWIG_OK;
    }
  };

  template <> 
  struct traits_check<PyObject *, value_category> {
    static bool check(PyObject *) {
      return true;
    }
  };

  template <>  struct traits_from<PyObject *> {
    typedef PyObject * value_type;
    static PyObject *from(const value_type& val) {
      Py_XINCREF(val);
      return val;
    }
  };
  
}

namespace swig {
  template <class Difference>
  inline size_t
  check_index(Difference i, size_t size, bool insert = false) {
    if ( i < 0 ) {
      if ((size_t) (-i) <= size)
	return (size_t) (i + size);
    } else if ( (size_t) i < size ) {
      return (size_t) i;
    } else if (insert && ((size_t) i == size)) {
      return size;
    }
    throw std::out_of_range("index out of range");
  }

  template <class Difference>
  void
  slice_adjust(Difference i, Difference j, Py_ssize_t step, size_t size, Difference &ii, Difference &jj, bool insert = false) {
    if (step == 0) {
      throw std::invalid_argument("slice step cannot be zero");
    } else if (step > 0) {
      // Required range: 0 <= i < size, 0 <= j < size
      if (i < 0) {
        ii = 0;
      } else if (i < (Difference)size) {
        ii = i;
      } else if (insert && (i >= (Difference)size)) {
        ii = (Difference)size;
      }
      if ( j < 0 ) {
        jj = 0;
      } else {
        jj = (j < (Difference)size) ? j : (Difference)size;
      }
    } else {
      // Required range: -1 <= i < size-1, -1 <= j < size-1
      if (i < -1) {
        ii = -1;
      } else if (i < (Difference) size) {
        ii = i;
      } else if (i >= (Difference)(size-1)) {
        ii = (Difference)(size-1);
      }
      if (j < -1) {
        jj = -1;
      } else {
        jj = (j < (Difference)size ) ? j : (Difference)(size-1);
      }
    }
  }

  template <class Sequence, class Difference>
  inline typename Sequence::iterator
  getpos(Sequence* self, Difference i)  {
    typename Sequence::iterator pos = self->begin();
    std::advance(pos, check_index(i,self->size()));
    return pos;
  }

  template <class Sequence, class Difference>
  inline typename Sequence::const_iterator
  cgetpos(const Sequence* self, Difference i)  {
    typename Sequence::const_iterator pos = self->begin();
    std::advance(pos, check_index(i,self->size()));
    return pos;
  }

  template <class Sequence, class Difference>
  inline Sequence*
  getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
    typename Sequence::size_type size = self->size();
    Difference ii = 0;
    Difference jj = 0;
    swig::slice_adjust(i, j, step, size, ii, jj);

    if (step > 0) {
      typename Sequence::const_iterator sb = self->begin();
      typename Sequence::const_iterator se = self->begin();
      std::advance(sb,ii);
      std::advance(se,jj);
      if (step == 1) {
        return new Sequence(sb, se);
      } else {
        Sequence *sequence = new Sequence();
        typename Sequence::const_iterator it = sb;
        while (it!=se) {
          sequence->push_back(*it);
          for (Py_ssize_t c=0; c<step && it!=se; ++c)
            it++;
        }
        return sequence;
      } 
    } else {
      Sequence *sequence = new Sequence();
      if (ii > jj) {
        typename Sequence::const_reverse_iterator sb = self->rbegin();
        typename Sequence::const_reverse_iterator se = self->rbegin();
        std::advance(sb,size-ii-1);
        std::advance(se,size-jj-1);
        typename Sequence::const_reverse_iterator it = sb;
        while (it!=se) {
          sequence->push_back(*it);
          for (Py_ssize_t c=0; c<-step && it!=se; ++c)
            it++;
        }
      }
      return sequence;
    }
  }

  template <class Sequence, class Difference, class InputSeq>
  inline void
  setslice(Sequence* self, Difference i, Difference j, Py_ssize_t step, const InputSeq& is = InputSeq()) {
    typename Sequence::size_type size = self->size();
    Difference ii = 0;
    Difference jj = 0;
    swig::slice_adjust(i, j, step, size, ii, jj, true);
    if (step > 0) {
      if (jj < ii)
        jj = ii;
      if (step == 1) {
        size_t ssize = jj - ii;
        if (ssize <= is.size()) {
          // expanding/staying the same size
          typename Sequence::iterator sb = self->begin();
          typename InputSeq::const_iterator isit = is.begin();
          std::advance(sb,ii);
          std::advance(isit, jj - ii);
          self->insert(std::copy(is.begin(), isit, sb), isit, is.end());
        } else {
          // shrinking
          typename Sequence::iterator sb = self->begin();
          typename Sequence::iterator se = self->begin();
          std::advance(sb,ii);
          std::advance(se,jj);
          self->erase(sb,se);
          sb = self->begin();
          std::advance(sb,ii);
          self->insert(sb, is.begin(), is.end());
        }
      } else {
        size_t replacecount = (jj - ii + step - 1) / step;
        if (is.size() != replacecount) {
          char msg[1024];
          sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
          throw std::invalid_argument(msg);
        }
        typename Sequence::const_iterator isit = is.begin();
        typename Sequence::iterator it = self->begin();
        std::advance(it,ii);
        for (size_t rc=0; rc<replacecount; ++rc) {
          *it++ = *isit++;
          for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
            it++;
        }
      }
    } else {
      if (jj > ii)
        jj = ii;
      size_t replacecount = (ii - jj - step - 1) / -step;
      if (is.size() != replacecount) {
        char msg[1024];
        sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
        throw std::invalid_argument(msg);
      }
      typename Sequence::const_iterator isit = is.begin();
      typename Sequence::reverse_iterator it = self->rbegin();
      std::advance(it,size-ii-1);
      for (size_t rc=0; rc<replacecount; ++rc) {
        *it++ = *isit++;
        for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
          it++;
      }
    }
  }

  template <class Sequence, class Difference>
  inline void
  delslice(Sequence* self, Difference i, Difference j, Py_ssize_t step) {
    typename Sequence::size_type size = self->size();
    Difference ii = 0;
    Difference jj = 0;
    swig::slice_adjust(i, j, step, size, ii, jj, true);
    if (step > 0) {
      if (jj > ii) {
        typename Sequence::iterator sb = self->begin();
        std::advance(sb,ii);
        if (step == 1) {
          typename Sequence::iterator se = self->begin();
          std::advance(se,jj);
          self->erase(sb,se);
        } else {
          typename Sequence::iterator it = sb;
          size_t delcount = (jj - ii + step - 1) / step;
          while (delcount) {
            it = self->erase(it);
            for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
              it++;
            delcount--;
          }
        }
      }
    } else {
      if (ii > jj) {
        typename Sequence::reverse_iterator sb = self->rbegin();
        std::advance(sb,size-ii-1);
        typename Sequence::reverse_iterator it = sb;
        size_t delcount = (ii - jj - step - 1) / -step;
        while (delcount) {
          it = typename Sequence::reverse_iterator(self->erase((++it).base()));
          for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
            it++;
          delcount--;
        }
      }
    }
  }
}


#if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
#  if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL)
#    define SWIG_STD_NOITERATOR_TRAITS_STL
#  endif
#endif

#if !defined(SWIG_STD_NOITERATOR_TRAITS_STL)
#include <iterator>
#else
namespace std {
  template <class Iterator>
  struct iterator_traits {
    typedef ptrdiff_t difference_type;
    typedef typename Iterator::value_type value_type;
  };

  template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance>
  struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > {
    typedef Distance difference_type;
    typedef T value_type;
  };

  template <class T>
  struct iterator_traits<T*> {
    typedef T value_type;
    typedef ptrdiff_t difference_type;
  };

  template<typename _InputIterator>
  inline typename iterator_traits<_InputIterator>::difference_type
  distance(_InputIterator __first, _InputIterator __last)
  {
    typename iterator_traits<_InputIterator>::difference_type __n = 0;
    while (__first != __last) {
      ++__first; ++__n;
    }
    return __n;
  }
}
#endif


namespace swig {
  template<typename OutIterator>
  class SwigPyIterator_T :  public SwigPyIterator
  {
  public:
    typedef OutIterator out_iterator;
    typedef typename std::iterator_traits<out_iterator>::value_type value_type;    
    typedef SwigPyIterator_T<out_iterator> self_type;

    SwigPyIterator_T(out_iterator curr, PyObject *seq)
      : SwigPyIterator(seq), current(curr)
    {
    }

    const out_iterator& get_current() const
    {
      return current;
    }

    
    bool equal (const SwigPyIterator &iter) const
    {
      const self_type *iters = dynamic_cast<const self_type *>(&iter);
      if (iters) {
	return (current == iters->get_current());
      } else {
	throw std::invalid_argument("bad iterator type");
      }
    }
    
    ptrdiff_t distance(const SwigPyIterator &iter) const
    {
      const self_type *iters = dynamic_cast<const self_type *>(&iter);
      if (iters) {
	return std::distance(current, iters->get_current());
      } else {
	throw std::invalid_argument("bad iterator type");
      }
    }    
    
  protected:
    out_iterator current;
  };
  
  template <class ValueType>
  struct from_oper 
  {
    typedef const ValueType& argument_type;
    typedef PyObject *result_type;
    result_type operator()(argument_type v) const
    {
      return swig::from(v);
    }
  };

  template<typename OutIterator, 
	   typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
	   typename FromOper = from_oper<ValueType> >
  class SwigPyIteratorOpen_T :  public SwigPyIterator_T<OutIterator>
  {
  public:
    FromOper from;
    typedef OutIterator out_iterator;
    typedef ValueType value_type;
    typedef SwigPyIterator_T<out_iterator>  base;
    typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
    
    SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
      : SwigPyIterator_T<OutIterator>(curr, seq)
    {
    }
    
    PyObject *value() const {
      return from(static_cast<const value_type&>(*(base::current)));
    }
    
    SwigPyIterator *copy() const
    {
      return new self_type(*this);
    }

    SwigPyIterator *incr(size_t n = 1)
    {
      while (n--) {
	++base::current;
      }
      return this;
    }

    SwigPyIterator *decr(size_t n = 1)
    {
      while (n--) {
	--base::current;
      }
      return this;
    }
  };

  template<typename OutIterator, 
	   typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
	   typename FromOper = from_oper<ValueType> >
  class SwigPyIteratorClosed_T :  public SwigPyIterator_T<OutIterator>
  {
  public:
    FromOper from;
    typedef OutIterator out_iterator;
    typedef ValueType value_type;
    typedef SwigPyIterator_T<out_iterator>  base;    
    typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
    
    SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
      : SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last)
    {
    }
    
    PyObject *value() const {
      if (base::current == end) {
	throw stop_iteration();
      } else {
	return from(static_cast<const value_type&>(*(base::current)));
      }
    }
    
    SwigPyIterator *copy() const
    {
      return new self_type(*this);
    }

    SwigPyIterator *incr(size_t n = 1)
    {
      while (n--) {
	if (base::current == end) {
	  throw stop_iteration();
	} else {
	  ++base::current;
	}
      }
      return this;
    }

    SwigPyIterator *decr(size_t n = 1)
    {
      while (n--) {
	if (base::current == begin) {
	  throw stop_iteration();
	} else {
	  --base::current;
	}
      }
      return this;
    }

  private:
    out_iterator begin;
    out_iterator end;
  };

  template<typename OutIter>
  inline SwigPyIterator*
  make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
  {
    return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq);
  }

  template<typename OutIter>
  inline SwigPyIterator*
  make_output_iterator(const OutIter& current, PyObject *seq = 0)
  {
    return new SwigPyIteratorOpen_T<OutIter>(current, seq);
  }

}


namespace swig
{
  template <class T>
  struct SwigPySequence_Ref
  {
    SwigPySequence_Ref(PyObject* seq, int index)
      : _seq(seq), _index(index)
    {
    }
    
    operator T () const
    {
      swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
      try {
	return swig::as<T>(item, true);
      } catch (std::exception& e) {
	char msg[1024];
	sprintf(msg, "in sequence element %d ", _index);
	if (!PyErr_Occurred()) {
	  ::SWIG_Error(SWIG_TypeError,  swig::type_name<T>());
	}
	SWIG_Python_AddErrorMsg(msg);
	SWIG_Python_AddErrorMsg(e.what());
	throw;
      }
    }

    SwigPySequence_Ref& operator=(const T& v)
    {
      PySequence_SetItem(_seq, _index, swig::from<T>(v));
      return *this;
    }

  private:
    PyObject* _seq;
    int _index;
  };

  template <class T>
  struct SwigPySequence_ArrowProxy
  {
    SwigPySequence_ArrowProxy(const T& x): m_value(x) {}
    const T* operator->() const { return &m_value; }
    operator const T*() const { return &m_value; }
    T m_value;
  };

  template <class T, class Reference >
  struct SwigPySequence_InputIterator
  {
    typedef SwigPySequence_InputIterator<T, Reference > self;

    typedef std::random_access_iterator_tag iterator_category;
    typedef Reference reference;
    typedef T value_type;
    typedef T* pointer;
    typedef int difference_type;

    SwigPySequence_InputIterator()
    {
    }

    SwigPySequence_InputIterator(PyObject* seq, int index)
      : _seq(seq), _index(index)
    {
    }

    reference operator*() const
    {
      return reference(_seq, _index);
    }

    SwigPySequence_ArrowProxy<T>
    operator->() const {
      return SwigPySequence_ArrowProxy<T>(operator*());
    }

    bool operator==(const self& ri) const
    {
      return (_index == ri._index) && (_seq == ri._seq);
    }

    bool operator!=(const self& ri) const
    {
      return !(operator==(ri));
    }

    self& operator ++ ()
    {
      ++_index;
      return *this;
    }

    self& operator -- ()
    {
      --_index;
      return *this;
    }

    self& operator += (difference_type n)
    {
      _index += n;
      return *this;
    }

    self operator +(difference_type n) const
    {
      return self(_seq, _index + n);
    }

    self& operator -= (difference_type n)
    {
      _index -= n;
      return *this;
    }

    self operator -(difference_type n) const
    {
      return self(_seq, _index - n);
    }

    difference_type operator - (const self& ri) const
    {
      return _index - ri._index;
    }

    bool operator < (const self& ri) const
    {
      return _index < ri._index;
    }

    reference
    operator[](difference_type n) const
    {
      return reference(_seq, _index + n);
    }

  private:
    PyObject* _seq;
    difference_type _index;
  };

  template <class T>
  struct SwigPySequence_Cont
  {
    typedef SwigPySequence_Ref<T> reference;
    typedef const SwigPySequence_Ref<T> const_reference;
    typedef T value_type;
    typedef T* pointer;
    typedef int difference_type;
    typedef int size_type;
    typedef const pointer const_pointer;
    typedef SwigPySequence_InputIterator<T, reference> iterator;
    typedef SwigPySequence_InputIterator<T, const_reference> const_iterator;

    SwigPySequence_Cont(PyObject* seq) : _seq(0)
    {
      if (!PySequence_Check(seq)) {
	throw std::invalid_argument("a sequence is expected");
      }
      _seq = seq;
      Py_INCREF(_seq);
    }

    ~SwigPySequence_Cont()
    {
      Py_XDECREF(_seq);
    }

    size_type size() const
    {
      return static_cast<size_type>(PySequence_Size(_seq));
    }

    bool empty() const
    {
      return size() == 0;
    }

    iterator begin()
    {
      return iterator(_seq, 0);
    }

    const_iterator begin() const
    {
      return const_iterator(_seq, 0);
    }

    iterator end()
    {
      return iterator(_seq, size());
    }

    const_iterator end() const
    {
      return const_iterator(_seq, size());
    }

    reference operator[](difference_type n)
    {
      return reference(_seq, n);
    }

    const_reference operator[](difference_type n)  const
    {
      return const_reference(_seq, n);
    }

    bool check(bool set_err = true) const
    {
      int s = size();
      for (int i = 0; i < s; ++i) {
	swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
	if (!swig::check<value_type>(item)) {
	  if (set_err) {
	    char msg[1024];
	    sprintf(msg, "in sequence element %d", i);
	    SWIG_Error(SWIG_RuntimeError, msg);
	  }
	  return false;
	}
      }
      return true;
    }

  private:
    PyObject* _seq;
  };

}


/* ---------------------------------------------------------------------
 * Numenta Platform for Intelligent Computing (NuPIC)
 * Copyright (C) 2013, Numenta, Inc.  Unless you have an agreement
 * with Numenta, Inc., for a separate license for this software code, the
 * following terms and conditions apply:
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses.
 *
 * http://numenta.org/licenses/
 * ---------------------------------------------------------------------
 */

#include <Python.h>

#include <sstream>
#include <iostream>
#include <fstream>
#include <vector>

#include <nupic/math/Types.hpp>
#include <nupic/math/Convolution.hpp>
#include <nupic/math/Rotation.hpp>
#include <nupic/math/Erosion.hpp>
#include <nupic/algorithms/GaborNode.hpp>
#include <nupic/algorithms/ImageSensorLite.hpp>
#include <nupic/algorithms/Scanning.hpp>

#include <nupic/math/SparseMatrix.hpp>
#include <nupic/math/SparseBinaryMatrix.hpp>
#include <nupic/algorithms/Svm.hpp>
#include <nupic/algorithms/Linear.hpp>
#include <nupic/algorithms/SpatialPooler.hpp>

#include <nupic/algorithms/Cell.hpp>
#include <nupic/algorithms/Cells4.hpp>
#include <nupic/algorithms/ClassifierResult.hpp>
#include <nupic/algorithms/Connections.hpp>
#include <nupic/algorithms/FastClaClassifier.hpp>
#include <nupic/algorithms/InSynapse.hpp>
#include <nupic/algorithms/OutSynapse.hpp>
#include <nupic/algorithms/SegmentUpdate.hpp>

#include <nupic/proto/SpatialPoolerProto.capnp.h>

#include <numpy/arrayobject.h>
#include <py_support/NumpyVector.hpp>
#include <py_support/PyCapnp.hpp>
#include <py_support/PythonStream.hpp>
#include <py_support/PyHelpers.hpp>

// Hack to fix SWIGPY_SLICE_ARG not found bug
#if PY_VERSION_HEX >= 0x03020000
# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
#else
# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
#endif

/// %template(_InSynapse) nupic::algorithms::Cells3::InSynapse<nupic::UInt32, nupic::Real32>;
/// %template(Segment3_32) nupic::algorithms::Cells3::Segment<nupic::UInt32, nupic::Real32>;
/// %template(Cell3_32) nupic::algorithms::Cells3::Cell<nupic::UInt32, nupic::Real32>;
/// %template(Cells3_32) nupic::algorithms::Cells3::Cells3<nupic::UInt32, nupic::Real32>;
using namespace nupic::algorithms::Cells4;
using namespace nupic::algorithms::cla_classifier;
using namespace nupic;

#define CHECKSIZE(var) \
  NTA_ASSERT((var)->descr->elsize == 4) << " elsize:" << (var)->descr->elsize




void forceRetentionOfGaborComputeWithinLibrary(void) {
 gaborCompute( NULL,                // const NUMPY_ARRAY * psGaborBank
               NULL,                // const NUMPY_ARRAY * psInput
               NULL,                // const NUMPY_ARRAY * psAlpha
               NULL,                // const NUMPY_ARRAY * psBBox
               NULL,                // const NUMPY_ARRAY * psImageBox
               NULL,                // const NUMPY_ARRAY * psOutput
               0.0f,                // float fGainConstant
               (EDGE_MODE)0,        // EDGE_MODE eEdgeMode
               0.0f,                // float fOffImageFillValue
               (PHASE_MODE)0,       // PHASE_MODE ePhaseMode
               (NORMALIZE_METHOD)0, // NORMALIZE_METHOD eNormalizeMethod
               (NORMALIZE_MODE)0,   // NORMALIZE_MODE eNormalizeMode
               (PHASENORM_MODE)0,   // PHASENORM_MODE ePhaseNormMode
               (POSTPROC_METHOD)0,  // POSTPROC_METHOD ePostProcMethod
               0.0f,                // float fPostProcSlope
               0.0f,                // float fPostProcMidpoint
               0.0f,                // float fPostProcMin
               0.0f,                // float fPostProcMax
               NULL,                // const NUMPY_ARRAY * psBufferIn
               NULL,                // const NUMPY_ARRAY * psBufferOut
               NULL,                // const NUMPY_ARRAY * psPostProcLUT
               0.0f                 // float fPostProcScalar
  );
  // Initialization of log system from python disabled for now.
  // See comments in gaborNode.cpp
  // initFromPython(0);
}



void forceRetentionOfImageSensorLiteLibrary(void) {
  extractAuxInfo( NULL,          // const char * pCtlBufAddr
                  NULL,          // BBOX * psBox
                  NULL,          // int * pnAddress
                  NULL,          // int * pnPartitionID
                  NULL,          // int * pnCategoryID
                  NULL,          // int * pnVideoID
                  NULL           // int * pnAlphaAddress
  );
}


#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
#   define LLONG_MAX __LONG_LONG_MAX__
#   define LLONG_MIN (-LLONG_MAX - 1LL)
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
#endif


SWIGINTERN int
SWIG_AsVal_double (PyObject *obj, double *val)
{
  int res = SWIG_TypeError;
  if (PyFloat_Check(obj)) {
    if (val) *val = PyFloat_AsDouble(obj);
    return SWIG_OK;
  } else if (PyInt_Check(obj)) {
    if (val) *val = PyInt_AsLong(obj);
    return SWIG_OK;
  } else if (PyLong_Check(obj)) {
    double v = PyLong_AsDouble(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    double d = PyFloat_AsDouble(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = d;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      long v = PyLong_AsLong(obj);
      if (!PyErr_Occurred()) {
	if (val) *val = v;
	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
      } else {
	PyErr_Clear();
      }
    }
  }
#endif
  return res;
}


#include <float.h>


#include <math.h>


SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
  double x = *d;
  if ((min <= x && x <= max)) {
   double fx = floor(x);
   double cx = ceil(x);
   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
   if ((errno == EDOM) || (errno == ERANGE)) {
     errno = 0;
   } else {
     double summ, reps, diff;
     if (rd < x) {
       diff = x - rd;
     } else if (rd > x) {
       diff = rd - x;
     } else {
       return 1;
     }
     summ = rd + x;
     reps = diff/summ;
     if (reps < 8*DBL_EPSILON) {
       *d = rd;
       return 1;
     }
   }
  }
  return 0;
}


SWIGINTERN int
SWIG_AsVal_long (PyObject *obj, long* val)
{
  if (PyInt_Check(obj)) {
    if (val) *val = PyInt_AsLong(obj);
    return SWIG_OK;
  } else if (PyLong_Check(obj)) {
    long v = PyLong_AsLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    long v = PyInt_AsLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
	if (val) *val = (long)(d);
	return res;
      }
    }
  }
#endif
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int (PyObject * obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< int >(v);
    }
  }  
  return res;
}


SWIGINTERNINLINE PyObject*
  SWIG_From_int  (int value)
{
  return PyInt_FromLong((long) value);
}


/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
#ifndef SWIG_isfinite
# if defined(isfinite)
#  define SWIG_isfinite(X) (isfinite(X))
# elif defined(_MSC_VER)
#  define SWIG_isfinite(X) (_finite(X))
# elif defined(__sun) && defined(__SVR4)
#  include <ieeefp.h>
#  define SWIG_isfinite(X) (finite(X))
# endif
#endif


/* Accept infinite as a valid float value unless we are unable to check if a value is finite */
#ifdef SWIG_isfinite
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
#else
# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
#endif


SWIGINTERN int
SWIG_AsVal_float (PyObject * obj, float *val)
{
  double v;
  int res = SWIG_AsVal_double (obj, &v);
  if (SWIG_IsOK(res)) {
    if (SWIG_Float_Overflow_Check(v)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< float >(v);
    }
  }  
  return res;
}


  #define SWIG_From_double   PyFloat_FromDouble 


SWIGINTERNINLINE PyObject *
SWIG_From_float  (float value)
{    
  return SWIG_From_double  (value);
}


SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
#if PY_VERSION_HEX>=0x03000000
  if (PyUnicode_Check(obj))
#else  
  if (PyString_Check(obj))
#endif
  {
    char *cstr; Py_ssize_t len;
#if PY_VERSION_HEX>=0x03000000
    if (!alloc && cptr) {
        /* We can't allow converting without allocation, since the internal
           representation of string in Python 3 is UCS-2/UCS-4 but we require
           a UTF-8 representation.
           TODO(bhy) More detailed explanation */
        return SWIG_RuntimeError;
    }
    obj = PyUnicode_AsUTF8String(obj);
    PyBytes_AsStringAndSize(obj, &cstr, &len);
    if(alloc) *alloc = SWIG_NEWOBJ;
#else
    PyString_AsStringAndSize(obj, &cstr, &len);
#endif
    if (cptr) {
      if (alloc) {
	/* 
	   In python the user should not be able to modify the inner
	   string representation. To warranty that, if you define
	   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
	   buffer is always returned.

	   The default behavior is just to return the pointer value,
	   so, be careful.
	*/ 
#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
	if (*alloc != SWIG_OLDOBJ) 
#else
	if (*alloc == SWIG_NEWOBJ) 
#endif
	  {
	    *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
	    *alloc = SWIG_NEWOBJ;
	  }
	else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      } else {
        #if PY_VERSION_HEX>=0x03000000
        assert(0); /* Should never reach here in Python 3 */
        #endif
	*cptr = SWIG_Python_str_AsChar(obj);
      }
    }
    if (psize) *psize = len + 1;
#if PY_VERSION_HEX>=0x03000000
    Py_XDECREF(obj);
#endif
    return SWIG_OK;
  } else {
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *) vptr;
	if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }
  return SWIG_TypeError;
}




SWIGINTERN void nupic_algorithms_linear_linear_create_problem__SWIG_1(nupic::algorithms::linear::linear *self,int size,int n_dims,PyObject *labelsIn,PyObject *samplesIn,float bias=-1.0){
    PyArrayObject* labels = (PyArrayObject*)labelsIn;
    PyArrayObject* samples = (PyArrayObject*)samplesIn;

    self->create_problem(size, n_dims,
             (float*)(labels->data), (float*)(samples->data),
             bias);
  }
SWIGINTERN void nupic_algorithms_linear_linear_cross_validation__SWIG_1(nupic::algorithms::linear::linear *self,int nr_fold,PyObject *py_target){
    PyArrayObject* target = (PyArrayObject*)py_target;
    self->cross_validation(nr_fold, (int*)target->data);
  }
SWIGINTERN int nupic_algorithms_linear_linear_predict_values__SWIG_1(nupic::algorithms::linear::linear *self,PyObject *py_x,PyObject *py_dec_values){
    PyArrayObject* x = (PyArrayObject*)py_x;
    PyArrayObject* dec_values = (PyArrayObject*)py_dec_values;
    return self->predict_values((float*)x->data, (float*)dec_values->data);
  }
SWIGINTERN int nupic_algorithms_linear_linear_predict__SWIG_1(nupic::algorithms::linear::linear *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*)py_x;
    return self->predict((float*)x->data);
  }
SWIGINTERN int nupic_algorithms_linear_linear_predict_probability__SWIG_1(nupic::algorithms::linear::linear *self,PyObject *py_x,PyObject *py_prob_estimates){
    PyArrayObject* x = (PyArrayObject*)py_x;
    PyArrayObject* prob_estimates = (PyArrayObject*)py_prob_estimates;
    return self->predict_probability((float*)x->data, (float*)prob_estimates->data);
  }

SWIGINTERN int
SWIG_AsVal_bool (PyObject *obj, bool *val)
{
  int r = PyObject_IsTrue(obj);
  if (r == -1)
    return SWIG_ERROR;
  if (val) *val = r ? true : false;
  return SWIG_OK;
}


SWIGINTERNINLINE PyObject*
  SWIG_From_bool  (bool value)
{
  return PyBool_FromLong(value ? 1 : 0);
}


namespace swig {
  template <> struct traits<float > {
    typedef value_category category;
    static const char* type_name() { return"float"; }
  };  
  template <>  struct traits_asval<float > {   
    typedef float value_type;
    static int asval(PyObject *obj, value_type *val) { 
      return SWIG_AsVal_float (obj, val);
    }
  };
  template <>  struct traits_from<float > {
    typedef float value_type;
    static PyObject *from(const value_type& val) {
      return SWIG_From_float  (val);
    }
  };
}


namespace swig {
  template <class SwigPySeq, class Seq>
  inline void
  assign(const SwigPySeq& swigpyseq, Seq* seq) {
    // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
    typedef typename SwigPySeq::value_type value_type;
    typename SwigPySeq::const_iterator it = swigpyseq.begin();
    for (;it != swigpyseq.end(); ++it) {
      seq->insert(seq->end(),(value_type)(*it));
    }
  }

  template <class Seq, class T = typename Seq::value_type >
  struct traits_asptr_stdseq {
    typedef Seq sequence;
    typedef T value_type;

    static int asptr(PyObject *obj, sequence **seq) {
      if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
	sequence *p;
	if (::SWIG_ConvertPtr(obj,(void**)&p,
			      swig::type_info<sequence>(),0) == SWIG_OK) {
	  if (seq) *seq = p;
	  return SWIG_OLDOBJ;
	}
      } else if (PySequence_Check(obj)) {
	try {
	  SwigPySequence_Cont<value_type> swigpyseq(obj);
	  if (seq) {
	    sequence *pseq = new sequence();
	    assign(swigpyseq, pseq);
	    *seq = pseq;
	    return SWIG_NEWOBJ;
	  } else {
	    return swigpyseq.check() ? SWIG_OK : SWIG_ERROR;
	  }
	} catch (std::exception& e) {
	  if (seq) {
	    if (!PyErr_Occurred()) {
	      PyErr_SetString(PyExc_TypeError, e.what());
	    }
	  }
	  return SWIG_ERROR;
	}
      }
      return SWIG_ERROR;
    }
  };

  template <class Seq, class T = typename Seq::value_type >
  struct traits_from_stdseq {
    typedef Seq sequence;
    typedef T value_type;
    typedef typename Seq::size_type size_type;
    typedef typename sequence::const_iterator const_iterator;

    static PyObject *from(const sequence& seq) {
#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
      swig_type_info *desc = swig::type_info<sequence>();
      if (desc && desc->clientdata) {
	return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
      }
#endif
      size_type size = seq.size();
      if (size <= (size_type)INT_MAX) {
	PyObject *obj = PyTuple_New((int)size);
	int i = 0;
	for (const_iterator it = seq.begin();
	     it != seq.end(); ++it, ++i) {
	  PyTuple_SetItem(obj,i,swig::from<value_type>(*it));
	}
	return obj;
      } else {
	PyErr_SetString(PyExc_OverflowError,"sequence size not valid in python");
	return NULL;
      }
    }
  };
}


  namespace swig {
    template <class T>
    struct traits_asptr<std::vector<T> >  {
      static int asptr(PyObject *obj, std::vector<T> **vec) {
	return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
      }
    };
    
    template <class T>
    struct traits_from<std::vector<T> > {
      static PyObject *from(const std::vector<T>& vec) {
	return traits_from_stdseq<std::vector<T> >::from(vec);
      }
    };
  }


      namespace swig {
	template <>  struct traits<std::vector<float, std::allocator< float > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "float" "," "std::allocator< float >" " >";
	  }
	};
      }
    
SWIGINTERN void nupic_algorithms_svm_svm_problem_get_samples(nupic::algorithms::svm::svm_problem *self,PyObject *samplesIn){
    PyArrayObject* samples_py = (PyArrayObject*)samplesIn;
    for (int i = 0; i < self->size(); ++i) {
      float* row_it = (float*)(samples_py->data+i*samples_py->strides[0]);
      *row_it++ = self->y_[i];
      for (int j = 0; j < self->n_dims(); ++j, ++row_it)
    *row_it = self->x_[i][j];
    }
  }

namespace swig {
  template <> struct traits<int > {
    typedef value_category category;
    static const char* type_name() { return"int"; }
  };  
  template <>  struct traits_asval<int > {   
    typedef int value_type;
    static int asval(PyObject *obj, value_type *val) { 
      return SWIG_AsVal_int (obj, val);
    }
  };
  template <>  struct traits_from<int > {
    typedef int value_type;
    static PyObject *from(const value_type& val) {
      return SWIG_From_int  (val);
    }
  };
}


      namespace swig {
	template <>  struct traits<std::vector<int, std::allocator< int > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "int" "," "std::allocator< int >" " >";
	  }
	};
      }
    
SWIGINTERN void nupic_algorithms_svm_svm_problem01_get_samples(nupic::algorithms::svm::svm_problem01 *self,PyObject *samplesIn){
    PyArrayObject* samples_py = (PyArrayObject*)samplesIn;
    for (int i = 0; i < self->size(); ++i) {
      float* row_it = (float*)(samples_py->data+i*samples_py->strides[0]);
      *row_it++ = self->y_[i];
      std::fill(row_it, row_it + self->n_dims(), (float) 0);
      for (int j = 0; j < self->nnz(i); ++j)
    *(row_it + self->x_[i][j]) = 1;
    }
  }
SWIGINTERN void nupic_algorithms_svm_svm_model_get_support_vectors(nupic::algorithms::svm::svm_model *self,PyObject *svIn){
    PyArrayObject* sv_py = (PyArrayObject*)svIn;
    for (int i = 0; i < self->size(); ++i) {
      float* row_it = (float*)(sv_py->data+i*sv_py->strides[0]);
      for (int j = 0; j < self->n_dims(); ++j, ++row_it)
    *row_it = self->sv[i][j];
    }
  }
SWIGINTERN void nupic_algorithms_svm_svm_model_get_support_vector_coefficients(nupic::algorithms::svm::svm_model *self,PyObject *svCoeffIn){
    PyArrayObject* sv_coeff_py = (PyArrayObject*)svCoeffIn;
    for (size_t i = 0; i < self->sv_coef.size(); ++i) {
      float* row_it = (float*)(sv_coeff_py->data+i*sv_coeff_py->strides[0]);
      for (int j = 0; j < self->size(); ++j, ++row_it)
    *row_it = self->sv_coef[i][j];
    }
  }
SWIGINTERN PyObject *nupic_algorithms_svm_svm_model_get_hyperplanes(nupic::algorithms::svm::svm_model *self){
    if (self->n_class() == 1)
      Py_RETURN_NONE;

    size_t m = self->w.size(), n = self->w[0].size();
    int dims[] = { int(m), int(n) };
    nupic::NumpyMatrix out(dims);
    for (size_t i = 0; i != m; ++i)
      for (size_t j = 0; j != n; ++j)
    *(out.addressOf(0,0) + i*n + j) = self->w[i][j];
    return out.forPython();
  }
SWIGINTERN PyObject *nupic_algorithms_svm_svm_dense___getstate__(nupic::algorithms::svm::svm_dense *self){
    SharedPythonOStream py_s(self->persistent_size());
    std::ostream& s = py_s.getStream();
    self->save(s);
    return py_s.close();
  }

SWIGINTERN int
SWIG_AsPtr_std_string (PyObject * obj, std::string **val) 
{
  char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
  if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
    if (buf) {
      if (val) *val = new std::string(buf, size - 1);
      if (alloc == SWIG_NEWOBJ) delete[] buf;
      return SWIG_NEWOBJ;
    } else {
      if (val) *val = 0;
      return SWIG_OLDOBJ;
    }
  } else {
    static int init = 0;
    static swig_type_info* descriptor = 0;
    if (!init) {
      descriptor = SWIG_TypeQuery("std::string" " *");
      init = 1;
    }
    if (descriptor) {
      std::string *vptr;
      int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
      if (SWIG_IsOK(res) && val) *val = vptr;
      return res;
    }
  }
  return SWIG_ERROR;
}

SWIGINTERN void nupic_algorithms_svm_svm_dense_loadFromString(nupic::algorithms::svm::svm_dense *self,std::string const &inString){
    std::istringstream inStream(inString);
    self->load(inStream);
  }
SWIGINTERN void nupic_algorithms_svm_svm_dense_add_sample(nupic::algorithms::svm::svm_dense *self,float y_val,PyObject *x_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    self->add_sample(y_val, (float*)x->data);
  }
SWIGINTERN float nupic_algorithms_svm_svm_dense_predict(nupic::algorithms::svm::svm_dense *self,PyObject *x_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    return self->predict((float*)x->data);
  }
SWIGINTERN float nupic_algorithms_svm_svm_dense_predict_probability(nupic::algorithms::svm::svm_dense *self,PyObject *x_vector,PyObject *proba_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    PyArrayObject* proba = (PyArrayObject*) proba_vector;
    return self->predict_probability((float*)x->data, (float*)proba->data);
  }
SWIGINTERN void nupic_algorithms_svm_svm_dense_save__SWIG_1(nupic::algorithms::svm::svm_dense *self,std::string const &filename){
    std::ofstream save_file(filename.c_str());
    self->save(save_file);
    save_file.close();
  }
SWIGINTERN void nupic_algorithms_svm_svm_dense_load__SWIG_1(nupic::algorithms::svm::svm_dense *self,std::string const &filename){
    std::ifstream load_file(filename.c_str());
    self->load(load_file);
    load_file.close();
  }
SWIGINTERN float nupic_algorithms_svm_svm_dense_cross_validate(nupic::algorithms::svm::svm_dense *self,int n_fold,float gamma,float C,float eps){
    float accuracy;
    Py_BEGIN_ALLOW_THREADS;
    accuracy = self->cross_validation(n_fold, gamma, C, eps);
    Py_END_ALLOW_THREADS;
    return accuracy;
  }
SWIGINTERN void nupic_algorithms_svm_svm_dense_trainReleaseGIL(nupic::algorithms::svm::svm_dense *self,float gamma,float C,float eps){
    Py_BEGIN_ALLOW_THREADS;
    self->train(gamma, C, eps);
    Py_END_ALLOW_THREADS;
  }
SWIGINTERN PyObject *nupic_algorithms_svm_svm_01___getstate__(nupic::algorithms::svm::svm_01 *self){
    SharedPythonOStream py_s(self->persistent_size());
    std::ostream& s = py_s.getStream();
    self->save(s);
    return py_s.close();
  }
SWIGINTERN void nupic_algorithms_svm_svm_01_loadFromString(nupic::algorithms::svm::svm_01 *self,std::string const &inString){
    std::istringstream inStream(inString);
    self->load(inStream);
  }
SWIGINTERN void nupic_algorithms_svm_svm_01_add_sample(nupic::algorithms::svm::svm_01 *self,float y_val,PyObject *x_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    self->add_sample(y_val, (float*)x->data);
  }
SWIGINTERN float nupic_algorithms_svm_svm_01_predict(nupic::algorithms::svm::svm_01 *self,PyObject *x_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    return self->predict((float*)x->data);
  }
SWIGINTERN float nupic_algorithms_svm_svm_01_predict_probability(nupic::algorithms::svm::svm_01 *self,PyObject *x_vector,PyObject *proba_vector){
    PyArrayObject* x = (PyArrayObject*) x_vector;
    PyArrayObject* proba = (PyArrayObject*) proba_vector;
    return self->predict_probability((float*)x->data, (float*)proba->data);
  }
SWIGINTERN float nupic_algorithms_svm_svm_01_cross_validate(nupic::algorithms::svm::svm_01 *self,int n_fold,float gamma,float C,float eps){
    float accuracy;
    Py_BEGIN_ALLOW_THREADS;
    accuracy = self->cross_validation(n_fold, gamma, C, eps);
    Py_END_ALLOW_THREADS;
    return accuracy;
  }
SWIGINTERN void nupic_algorithms_svm_svm_01_trainReleaseGIL(nupic::algorithms::svm::svm_01 *self,float gamma,float C,float eps){
    Py_BEGIN_ALLOW_THREADS;
    self->train(gamma, C, eps);
    Py_END_ALLOW_THREADS;
  }
SWIGINTERN void nupic_algorithms_svm_svm_01_save__SWIG_1(nupic::algorithms::svm::svm_01 *self,std::string const &filename){
    std::ofstream save_file(filename.c_str());
    self->save(save_file);
    save_file.close();
  }
SWIGINTERN void nupic_algorithms_svm_svm_01_load__SWIG_1(nupic::algorithms::svm::svm_01 *self,std::string const &filename){
    std::ifstream load_file(filename.c_str());
    self->load(load_file);
    load_file.close();
  }

SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
{
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(obj)) {
    long v = PyInt_AsLong(obj);
    if (v >= 0) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      return SWIG_OverflowError;
    }
  } else
#endif
  if (PyLong_Check(obj)) {
    unsigned long v = PyLong_AsUnsignedLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
#if PY_VERSION_HEX >= 0x03000000
      {
        long v = PyLong_AsLong(obj);
        if (!PyErr_Occurred()) {
          if (v < 0) {
            return SWIG_OverflowError;
          }
        } else {
          PyErr_Clear();
        }
      }
#endif
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    unsigned long v = PyLong_AsUnsignedLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
	if (val) *val = (unsigned long)(d);
	return res;
      }
    }
  }
#endif
  return SWIG_TypeError;
}


SWIGINTERNINLINE int
SWIG_AsVal_size_t (PyObject * obj, size_t *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
  return res;
}


  #define SWIG_From_long   PyLong_FromLong 


SWIGINTERNINLINE PyObject* 
SWIG_From_unsigned_SS_long  (unsigned long value)
{
  return (value > LONG_MAX) ?
    PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value)); 
}


SWIGINTERNINLINE PyObject *
SWIG_From_size_t  (size_t value)
{    
  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v > UINT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< unsigned int >(v);
    }
  }  
  return res;
}

SWIGINTERN void SeparableConvolution2D_Sl_float_Sg__init__SWIG_1(SeparableConvolution2D< float > *self,nupic::UInt32 nrows,nupic::UInt32 ncols,nupic::UInt32 f1_size,nupic::UInt32 f2_size,PyObject *pyF1,PyObject *pyF2){
    PyArrayObject *f1 = (PyArrayObject*) pyF1;
    PyArrayObject *f2 = (PyArrayObject*) pyF2;

    self->init(nrows, ncols, f1_size, f2_size, (float*)(f1->data), (float*)(f2->data));
  }
SWIGINTERN void SeparableConvolution2D_Sl_float_Sg__compute__SWIG_1(SeparableConvolution2D< float > *self,PyObject *pyData,PyObject *pyConvolved,bool rotated45=false){
    PyArrayObject* data = (PyArrayObject*)pyData;
    PyArrayObject* convolved = (PyArrayObject*)pyConvolved;

    self->compute((float*)(data->data), (float*)(convolved->data), rotated45);
  }
SWIGINTERN void SeparableConvolution2D_Sl_float_Sg__getBuffer(SeparableConvolution2D< float > const *self,PyObject *pyBuffer){
    PyArrayObject *buffer = (PyArrayObject*)pyBuffer;

    const size_t size = self->nrows_ * self->ncols_;
    std::copy(self->buffer_, self->buffer_ + size, (float*)(buffer->data));
  }
SWIGINTERN void Rotation45_Sl_float_Sg__rotate__SWIG_1(Rotation45< float > *self,PyObject *pyOriginal,PyObject *pyRotated,nupic::UInt32 nrows,nupic::UInt32 ncols,nupic::UInt32 z){
    PyArrayObject* original = (PyArrayObject*)pyOriginal;
    PyArrayObject* rotated = (PyArrayObject*)pyRotated;

    self->rotate((float*)(original->data), (float*)(rotated->data),
      nrows, ncols, z);
  }
SWIGINTERN void Rotation45_Sl_float_Sg__unrotate__SWIG_1(Rotation45< float > *self,PyObject *pyUnrotated,PyObject *pyRotated,nupic::UInt32 nrows,nupic::UInt32 ncols,nupic::UInt32 z){
    PyArrayObject* unrotated = (PyArrayObject*)pyUnrotated;
    PyArrayObject* rotated = (PyArrayObject*)pyRotated;

    self->unrotate((float*)(unrotated->data), (float*)(rotated->data),
      nrows, ncols, z);
  }
SWIGINTERN void Erosion_Sl_float_Sg__init__SWIG_1(Erosion< float > *self,nupic::UInt32 nrows,nupic::UInt32 ncols){
    self->init(nrows, ncols);
  }
SWIGINTERN void Erosion_Sl_float_Sg__compute__SWIG_1(Erosion< float > *self,PyObject *pyData,PyObject *pyEroded,nupic::UInt32 iterations,bool dilate=false){
    PyArrayObject* data = (PyArrayObject*)pyData;
    PyArrayObject* eroded = (PyArrayObject*)pyEroded;

    self->compute((float*)(data->data), (float*)(eroded->data),
                  iterations, dilate);
  }
SWIGINTERN void Erosion_Sl_float_Sg__getBuffer(Erosion< float > const *self,PyObject *pyBuffer){
    PyArrayObject *buffer = (PyArrayObject*)pyBuffer;

    const size_t size = self->nrows_ * self->ncols_;
    std::copy(self->buffer_, self->buffer_ + size, (float*)(buffer->data));
  }

  void computeAlpha(nupic::UInt32 xstep, nupic::UInt32 ystep,
                    nupic::UInt32 widthS, nupic::UInt32 heightS,
                    nupic::UInt32 imageWidth, nupic::UInt32 imageHeight,
                    nupic::UInt32 xcount, nupic::UInt32 ycount,
                    nupic::UInt32 weightWidth, float sharpness,
                    PyObject* pyData, PyObject* pyValues,
                    PyObject* pyCounts, PyObject* pyWeights)
  {
    PyArrayObject *data = (PyArrayObject*) pyData;
    PyArrayObject *values = (PyArrayObject*) pyValues;
    PyArrayObject *counts = (PyArrayObject*) pyCounts;
    PyArrayObject *weights = (PyArrayObject*) pyWeights;
    computeAlpha(xstep, ystep, widthS, heightS, imageWidth, imageHeight,
                 xcount, ycount, weightWidth, sharpness,
                 (float*)(data->data), (float*)(values->data),
                 (float*)(counts->data), (float*)(weights->data));
  }


SWIGINTERN int
SWIG_AsCharArray(PyObject * obj, char *val, size_t size)
{ 
  char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
  int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
  if (SWIG_IsOK(res)) {
    /* special case of single char conversion when we don't need space for NUL */
    if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize;
    if (csize <= size) {
      if (val) {
	if (csize) memcpy(val, cptr, csize*sizeof(char));
	if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
      }
      if (alloc == SWIG_NEWOBJ) {
	delete[] cptr;
	res = SWIG_DelNewMask(res);
      }      
      return res;
    }
    if (alloc == SWIG_NEWOBJ) delete[] cptr;
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_char (PyObject * obj, char *val)
{    
  int res = SWIG_AsCharArray(obj, val, 1);
  if (!SWIG_IsOK(res)) {
    long v;
    res = SWIG_AddCast(SWIG_AsVal_long (obj, &v));
    if (SWIG_IsOK(res)) {
      if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
	if (val) *val = static_cast< char >(v);
      } else {
	res = SWIG_OverflowError;
      }
    }
  }
  return res;
}


SWIGINTERNINLINE PyObject *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > INT_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
    } else {
#if PY_VERSION_HEX >= 0x03000000
#if PY_VERSION_HEX >= 0x03010000
      return PyUnicode_DecodeUTF8(carray, static_cast< int >(size), "surrogateescape");
#else
      return PyUnicode_FromStringAndSize(carray, static_cast< int >(size));
#endif
#else
      return PyString_FromStringAndSize(carray, static_cast< int >(size));
#endif
    }
  } else {
    return SWIG_Py_Void();
  }
}


SWIGINTERNINLINE PyObject *
SWIG_From_char  (char c) 
{ 
  return SWIG_FromCharPtrAndSize(&c,1);
}


namespace swig {
  template <> struct traits<char > {
    typedef value_category category;
    static const char* type_name() { return"char"; }
  };  
  template <>  struct traits_asval<char > {   
    typedef char value_type;
    static int asval(PyObject *obj, value_type *val) { 
      return SWIG_AsVal_char (obj, val);
    }
  };
  template <>  struct traits_from<char > {
    typedef char value_type;
    static PyObject *from(const value_type& val) {
      return SWIG_From_char  (val);
    }
  };
}


      namespace swig {
	template <>  struct traits<std::vector<char, std::allocator< char > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "char" "," "std::allocator< char >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_nupic_Byte_Sg__iterator(std::vector< nupic::Byte > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_nupic_Byte_Sg____nonzero__(std::vector< nupic::Byte > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_nupic_Byte_Sg____bool__(std::vector< nupic::Byte > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< char >::size_type std_vector_Sl_nupic_Byte_Sg____len__(std::vector< nupic::Byte > const *self){
      return self->size();
    }
SWIGINTERN std::vector< char >::value_type std_vector_Sl_nupic_Byte_Sg__pop(std::vector< nupic::Byte > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<char,std::allocator< char > >::value_type x = self->back();
      self->pop_back();
      return x;
    }

SWIGINTERNINLINE int
SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, val ? &v : 0);
  if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
  return res;
}

SWIGINTERN std::vector< char,std::allocator< char > > *std_vector_Sl_nupic_Byte_Sg____getslice__(std::vector< nupic::Byte > *self,std::vector< char >::difference_type i,std::vector< char >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____setslice__(std::vector< nupic::Byte > *self,std::vector< char >::difference_type i,std::vector< char >::difference_type j,std::vector< char,std::allocator< char > > const &v=std::vector< char,std::allocator< char > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____delslice__(std::vector< nupic::Byte > *self,std::vector< char >::difference_type i,std::vector< char >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____delitem____SWIG_0(std::vector< nupic::Byte > *self,std::vector< char >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< char,std::allocator< char > > *std_vector_Sl_nupic_Byte_Sg____getitem____SWIG_0(std::vector< nupic::Byte > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return NULL;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<char,std::allocator< char > >::difference_type id = i;
      std::vector<char,std::allocator< char > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_0(std::vector< nupic::Byte > *self,PySliceObject *slice,std::vector< char,std::allocator< char > > const &v){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<char,std::allocator< char > >::difference_type id = i;
      std::vector<char,std::allocator< char > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_1(std::vector< nupic::Byte > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<char,std::allocator< char > >::difference_type id = i;
      std::vector<char,std::allocator< char > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____delitem____SWIG_1(std::vector< nupic::Byte > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<char,std::allocator< char > >::difference_type id = i;
      std::vector<char,std::allocator< char > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< char >::value_type const &std_vector_Sl_nupic_Byte_Sg____getitem____SWIG_1(std::vector< nupic::Byte > const *self,std::vector< char >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_2(std::vector< nupic::Byte > *self,std::vector< char >::difference_type i,std::vector< char >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg__append(std::vector< nupic::Byte > *self,std::vector< char >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< char >::iterator std_vector_Sl_nupic_Byte_Sg__erase__SWIG_0(std::vector< nupic::Byte > *self,std::vector< char >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< char >::iterator std_vector_Sl_nupic_Byte_Sg__erase__SWIG_1(std::vector< nupic::Byte > *self,std::vector< char >::iterator first,std::vector< char >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< char >::iterator std_vector_Sl_nupic_Byte_Sg__insert__SWIG_0(std::vector< nupic::Byte > *self,std::vector< char >::iterator pos,std::vector< char >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_nupic_Byte_Sg__insert__SWIG_1(std::vector< nupic::Byte > *self,std::vector< char >::iterator pos,std::vector< char >::size_type n,std::vector< char >::value_type const &x){ self->insert(pos, n, x); }

namespace swig {
  template <> struct traits<size_t > {
    typedef value_category category;
    static const char* type_name() { return"size_t"; }
  };  
  template <>  struct traits_asval<size_t > {   
    typedef size_t value_type;
    static int asval(PyObject *obj, value_type *val) { 
      return SWIG_AsVal_size_t (obj, val);
    }
  };
  template <>  struct traits_from<size_t > {
    typedef size_t value_type;
    static PyObject *from(const value_type& val) {
      return SWIG_From_size_t  (val);
    }
  };
}


      namespace swig {
	template <>  struct traits<std::vector<size_t, std::allocator< size_t > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "size_t" "," "std::allocator< size_t >" " >";
	  }
	};
      }
    
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_size_t_Sg__iterator(std::vector< size_t > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool std_vector_Sl_size_t_Sg____nonzero__(std::vector< size_t > const *self){
      return !(self->empty());
    }
SWIGINTERN bool std_vector_Sl_size_t_Sg____bool__(std::vector< size_t > const *self){
      return !(self->empty());
    }
SWIGINTERN std::vector< size_t >::size_type std_vector_Sl_size_t_Sg____len__(std::vector< size_t > const *self){
      return self->size();
    }
SWIGINTERN std::vector< size_t >::value_type std_vector_Sl_size_t_Sg__pop(std::vector< size_t > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<size_t,std::allocator< size_t > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< size_t,std::allocator< size_t > > *std_vector_Sl_size_t_Sg____getslice__(std::vector< size_t > *self,std::vector< size_t >::difference_type i,std::vector< size_t >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____setslice__(std::vector< size_t > *self,std::vector< size_t >::difference_type i,std::vector< size_t >::difference_type j,std::vector< size_t,std::allocator< size_t > > const &v=std::vector< size_t,std::allocator< size_t > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____delslice__(std::vector< size_t > *self,std::vector< size_t >::difference_type i,std::vector< size_t >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____delitem____SWIG_0(std::vector< size_t > *self,std::vector< size_t >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< size_t,std::allocator< size_t > > *std_vector_Sl_size_t_Sg____getitem____SWIG_0(std::vector< size_t > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return NULL;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<size_t,std::allocator< size_t > >::difference_type id = i;
      std::vector<size_t,std::allocator< size_t > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____setitem____SWIG_0(std::vector< size_t > *self,PySliceObject *slice,std::vector< size_t,std::allocator< size_t > > const &v){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<size_t,std::allocator< size_t > >::difference_type id = i;
      std::vector<size_t,std::allocator< size_t > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____setitem____SWIG_1(std::vector< size_t > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<size_t,std::allocator< size_t > >::difference_type id = i;
      std::vector<size_t,std::allocator< size_t > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____delitem____SWIG_1(std::vector< size_t > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<size_t,std::allocator< size_t > >::difference_type id = i;
      std::vector<size_t,std::allocator< size_t > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN std::vector< size_t >::value_type const &std_vector_Sl_size_t_Sg____getitem____SWIG_1(std::vector< size_t > const *self,std::vector< size_t >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void std_vector_Sl_size_t_Sg____setitem____SWIG_2(std::vector< size_t > *self,std::vector< size_t >::difference_type i,std::vector< size_t >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void std_vector_Sl_size_t_Sg__append(std::vector< size_t > *self,std::vector< size_t >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN std::vector< size_t >::iterator std_vector_Sl_size_t_Sg__erase__SWIG_0(std::vector< size_t > *self,std::vector< size_t >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< size_t >::iterator std_vector_Sl_size_t_Sg__erase__SWIG_1(std::vector< size_t > *self,std::vector< size_t >::iterator first,std::vector< size_t >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< size_t >::iterator std_vector_Sl_size_t_Sg__insert__SWIG_0(std::vector< size_t > *self,std::vector< size_t >::iterator pos,std::vector< size_t >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_size_t_Sg__insert__SWIG_1(std::vector< size_t > *self,std::vector< size_t >::iterator pos,std::vector< size_t >::size_type n,std::vector< size_t >::value_type const &x){ self->insert(pos, n, x); }


  inline nupic::UInt32 non_zeros_ui8(PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* x = (PyArrayObject*)py_x;
    PyArrayObject* y = (PyArrayObject*)py_y;
    nupic::UInt32 nnz = 0;
    unsigned char* x_data = (unsigned char*) x->data;
    nupic::UInt32* y_res = (nupic::UInt32*) y->data;
    for (int i = 0; i != x->dimensions[0]; ++i)
      if (x_data[i] != 0)
        y_res[nnz++] = i;
    return nnz;
  }

  inline nupic::UInt32 non_zeros_i32(PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* x = (PyArrayObject*)py_x;
    PyArrayObject* y = (PyArrayObject*)py_y;
    nupic::UInt32 nnz = 0;
    nupic::UInt32* x_data = (nupic::UInt32*) x->data;
    nupic::UInt32* y_res = (nupic::UInt32*) y->data;
    for (int i = 0; i != x->dimensions[0]; ++i)
      if (x_data[i] != 0)
        y_res[nnz++] = i;
    return nnz;
  }

  inline nupic::UInt32 non_zeros_f32(PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* x = (PyArrayObject*)py_x;
    CHECKSIZE(x);
    PyArrayObject* y = (PyArrayObject*)py_y;
    CHECKSIZE(y);
    nupic::UInt32 nnz = 0;
    nupic::Real32* x_data = (nupic::Real32*) x->data;
    nupic::UInt32* y_res = (nupic::UInt32*) y->data;
    for (int i = 0; i != x->dimensions[0]; ++i)
      if (x_data[i] != 0)
        y_res[nnz++] = i;
    return nnz;
  }

  inline void rightVecProdAtIndices(PyObject* py_ind, PyObject* py_x, PyObject* py_y)
  {
    PyArrayObject* ind = (PyArrayObject*)py_ind;
    PyArrayObject* x = (PyArrayObject*)py_x;
    PyArrayObject* y = (PyArrayObject*)py_y;
    nupic::UInt32 nc = ind->dimensions[0];
    nupic::UInt32 ni = ind->dimensions[1];
    nupic::UInt32* ind_data = (nupic::UInt32*) ind->data;
    nupic::Real32* x_data = (nupic::Real32*) x->data;
    nupic::Real32* y_res = (nupic::Real32*) y->data;

    for (nupic::UInt32 c = 0; c != nc; ++c, ind_data += ni) {
      nupic::Real32 val = 0;
      for (nupic::UInt32 i = 0; i != ni; ++i)
        val += x_data[ind_data[i]];
      *y_res++ = val;
    }
  }


SWIGINTERNINLINE PyObject*
  SWIG_From_unsigned_SS_int  (unsigned int value)
{
  return PyInt_FromSize_t((size_t) value);
}



inline PyObject* generate2DGaussianSample(nupic::UInt32 nrows, nupic::UInt32 ncols,
                                          nupic::UInt32 nnzpr, nupic::UInt32 rf_x,
                                          nupic::Real32 sigma,
                                          nupic::Int32 seed =-1,
                                          bool sorted =true)
{
  std::vector<std::pair<nupic::UInt32, nupic::Real32> > x;
  nupic::gaussian_2d_pair_sample(nrows, ncols, nnzpr, rf_x, sigma, x,
                               (nupic::Real32) 1.0f, seed, sorted);
  PyObject* toReturn = PyList_New(nrows);
  for (size_t i = 0; i != nrows; ++i) {
    PyObject* one_master = PyList_New(nnzpr);
    for (size_t j = 0; j != nnzpr; ++j)
      PyList_SET_ITEM(one_master, j, PyInt_FromLong(x[i*nnzpr+j].first));
    PyList_SET_ITEM(toReturn, i, one_master);
  }
  return toReturn;
}



  //--------------------------------------------------------------------------------
  inline nupic::UInt32 getSegmentActivityLevel(PyObject* py_seg, PyObject* py_state,
                                             bool connectedSynapsesOnly,
                                             nupic::Real32 connectedPerm)
  {
    PyArrayObject* _state = (PyArrayObject*) py_state;
    nupic::Byte* state = (nupic::Byte*) _state->data;
    nupic::UInt32 stride0 = _state->strides[0];

    nupic::py::List seg;
    seg.assign(py_seg);
    Py_ssize_t n = seg.getCount();
    nupic::UInt32 activity = 0;

    if (connectedSynapsesOnly)
      for (Py_ssize_t i = 0; i < n; ++i) {
        nupic::py::List syn;
        syn.assign(seg.fastGetItem(i));
        nupic::Real32 p = (nupic::Real32) PyFloat_AsDouble(syn.fastGetItem(2));
        if (p >= connectedPerm) {
          nupic::UInt32 c = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(0));
          nupic::UInt32 j = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(1));
          activity += state[c * stride0 + j];
        }
      }
    else
      for (Py_ssize_t i = 0; i < n; ++i) {
        nupic::py::List syn;
        syn.assign(seg.fastGetItem(i));
        nupic::UInt32 c = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(0));
        nupic::UInt32 j = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(1));
        activity += state[c * stride0 + j];
      }

    return activity;
  }

  //--------------------------------------------------------------------------------
  inline bool isSegmentActive(PyObject* py_seg, PyObject* py_state,
                              nupic::Real32 connectedPerm,
                              nupic::UInt32 activationThreshold)
  {
    PyArrayObject* _state = (PyArrayObject*) py_state;
    nupic::Byte* state = (nupic::Byte*) _state->data;
    nupic::UInt32 stride0 = _state->strides[0];

    nupic::py::List seg;
    seg.assign(py_seg);
    Py_ssize_t n = seg.getCount();
    nupic::UInt32 activity = 0;

    if (n < (Py_ssize_t) activationThreshold)
      return false;

    for (Py_ssize_t i = 0; i < n; ++i) {
      nupic::py::List syn;
      syn.assign(seg.fastGetItem(i));
      nupic::Real32 p = (nupic::Real32) PyFloat_AsDouble(syn.fastGetItem(2));
      if (p >= connectedPerm) {
        nupic::UInt32 c = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(0));
        nupic::UInt32 j = (nupic::UInt32) PyLong_AsLong(syn.fastGetItem(1));
        activity += state[c * stride0 + j];
        if (activity >= activationThreshold)
          return true;
      }
    }

    return false;
  }


SWIGINTERNINLINE PyObject * 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


namespace swig {
  template <> struct traits<unsigned int > {
    typedef value_category category;
    static const char* type_name() { return"unsigned int"; }
  };  
  template <>  struct traits_asval<unsigned int > {   
    typedef unsigned int value_type;
    static int asval(PyObject *obj, value_type *val) { 
      return SWIG_AsVal_unsigned_SS_int (obj, val);
    }
  };
  template <>  struct traits_from<unsigned int > {
    typedef unsigned int value_type;
    static PyObject *from(const value_type& val) {
      return SWIG_From_unsigned_SS_int  (val);
    }
  };
}


      namespace swig {
	template <>  struct traits<std::vector<unsigned int, std::allocator< unsigned int > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "unsigned int" "," "std::allocator< unsigned int >" " >";
	  }
	};
      }
    

  namespace swig {

















































    template <class T, class U >
    struct traits_asptr<std::pair<T,U> >  {
      typedef std::pair<T,U> value_type;

      static int get_pair(PyObject* first, PyObject* second,
			  std::pair<T,U> **val) 
      {
	if (val) {
	  value_type *vp = (new std::pair<T,U>);
	  T *pfirst = &(vp->first);
	  int res1 = swig::asval((PyObject*)first, pfirst);
	  if (!SWIG_IsOK(res1)) return res1;
	  U *psecond = &(vp->second);
	  int res2 = swig::asval((PyObject*)second, psecond);
	  if (!SWIG_IsOK(res2)) return res2;
	  *val = vp;
	  return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
	} else {
	  T *pfirst = 0;
	  int res1 = swig::asval((PyObject*)first, pfirst);
	  if (!SWIG_IsOK(res1)) return res1;
	  U *psecond = 0;
	  int res2 = swig::asval((PyObject*)second, psecond);
	  if (!SWIG_IsOK(res2)) return res2;
	  return res1 > res2 ? res1 : res2;
	}	
      }

      static int asptr(PyObject *obj, std::pair<T,U> **val) {
	int res = SWIG_ERROR;
	if (PyTuple_Check(obj)) {
	  if (PyTuple_GET_SIZE(obj) == 2) {
	    res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val);
	  }
	} else if (PySequence_Check(obj)) {
	  if (PySequence_Size(obj) == 2) {
	    swig::SwigVar_PyObject first = PySequence_GetItem(obj,0);
	    swig::SwigVar_PyObject second = PySequence_GetItem(obj,1);
	    res = get_pair(first, second, val);
	  }
	} else {
	  value_type *p;
	  res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
	  if (SWIG_IsOK(res) && val)  *val = p;
	}
	return res;
      }
    };


    template <class T, class U >
    struct traits_from<std::pair<T,U> >   {
      static PyObject *from(const std::pair<T,U>& val) {
	PyObject* obj = PyTuple_New(2);
	PyTuple_SetItem(obj,0,swig::from(val.first));
	PyTuple_SetItem(obj,1,swig::from(val.second));
	return obj;
      }
    };
  }





































      namespace swig {
	template <>  struct traits<std::pair<unsigned int,unsigned int > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::pair<" "unsigned int" "," "unsigned int" " >";
	  }
	};
      }
    

      namespace swig {
	template <>  struct traits<std::vector<std::pair< nupic::UInt32,nupic::UInt32 >, std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "std::pair< nupic::UInt32,nupic::UInt32 >" "," "std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > >" " >";
	  }
	};
      }
    
SWIGINTERN void nupic_algorithms_Cells4_Cells4_loadFromString(nupic::algorithms::Cells4::Cells4 *self,std::string const &inString){
    std::istringstream inStream(inString);
    self->load(inStream);
  }
SWIGINTERN PyObject *nupic_algorithms_Cells4_Cells4___getstate__(nupic::algorithms::Cells4::Cells4 *self){
    SharedPythonOStream py_s(self->persistentSize());
    std::ostream& s = py_s.getStream();
    self->save(s);
    return py_s.close();
  }
SWIGINTERN void nupic_algorithms_Cells4_Cells4_setStatePointers__SWIG_1(nupic::algorithms::Cells4::Cells4 *self,PyObject *py_infActiveStateT,PyObject *py_infActiveStateT1,PyObject *py_infPredictedStateT,PyObject *py_infPredictedStateT1,PyObject *py_colConfidenceT,PyObject *py_colConfidenceT1,PyObject *py_cellConfidenceT,PyObject *py_cellConfidenceT1){
    PyArrayObject* infActiveStateT = (PyArrayObject*) py_infActiveStateT;
    PyArrayObject* infActiveStateT1 = (PyArrayObject*) py_infActiveStateT1;
    PyArrayObject* infPredictedStateT = (PyArrayObject*) py_infPredictedStateT;
    PyArrayObject* infPredictedStateT1 = (PyArrayObject*) py_infPredictedStateT1;
    PyArrayObject* colConfidenceT = (PyArrayObject*) py_colConfidenceT;
    PyArrayObject* colConfidenceT1 = (PyArrayObject*) py_colConfidenceT1;
    PyArrayObject* cellConfidenceT = (PyArrayObject*) py_cellConfidenceT;
    PyArrayObject* cellConfidenceT1 = (PyArrayObject*) py_cellConfidenceT1;

    self->setStatePointers((nupic::Byte*) infActiveStateT->data,
                           (nupic::Byte*) infActiveStateT1->data,
                           (nupic::Byte*) infPredictedStateT->data,
                           (nupic::Byte*) infPredictedStateT1->data,
                           (nupic::Real32*) colConfidenceT->data,
                           (nupic::Real32*) colConfidenceT1->data,
                           (nupic::Real32*) cellConfidenceT->data,
                           (nupic::Real32*) cellConfidenceT1->data);
  }
SWIGINTERN PyObject *nupic_algorithms_Cells4_Cells4_getStates(nupic::algorithms::Cells4::Cells4 const *self){
    nupic::UInt32 nCells = self->nCells();
    nupic::UInt32 nColumns = self->nColumns();

    nupic::Byte* cpp_activeT, *cpp_activeT1;
    nupic::Byte* cpp_predT, *cpp_predT1;
    nupic::Real32* cpp_colConfidenceT, *cpp_colConfidenceT1;
    nupic::Real32* cpp_confidenceT, *cpp_confidenceT1;

    self->getStatePointers(cpp_activeT, cpp_activeT1,
                           cpp_predT, cpp_predT1,
                           cpp_colConfidenceT, cpp_colConfidenceT1,
                           cpp_confidenceT, cpp_confidenceT1);

    nupic::NumpyVectorT<nupic::Byte> activeT(nCells, cpp_activeT);
    nupic::NumpyVectorT<nupic::Byte> activeT1(nCells, cpp_activeT1);
    nupic::NumpyVectorT<nupic::Byte> predT(nCells, cpp_predT);
    nupic::NumpyVectorT<nupic::Byte> predT1(nCells, cpp_predT1);
    nupic::NumpyVectorT<nupic::Real32> colConfidenceT(nColumns, cpp_colConfidenceT);
    nupic::NumpyVectorT<nupic::Real32> colConfidenceT1(nColumns, cpp_colConfidenceT1);
    nupic::NumpyVectorT<nupic::Real32> confidenceT(nCells, cpp_confidenceT);
    nupic::NumpyVectorT<nupic::Real32> confidenceT1(nCells, cpp_confidenceT1);

    PyObject *result = PyTuple_New(8);
    PyTuple_SET_ITEM(result, 0, activeT.forPython());
    PyTuple_SET_ITEM(result, 1, activeT1.forPython());
    PyTuple_SET_ITEM(result, 2, predT.forPython());
    PyTuple_SET_ITEM(result, 3, predT1.forPython());
    PyTuple_SET_ITEM(result, 4, colConfidenceT.forPython());
    PyTuple_SET_ITEM(result, 5, colConfidenceT1.forPython());
    PyTuple_SET_ITEM(result, 6, confidenceT.forPython());
    PyTuple_SET_ITEM(result, 7, confidenceT1.forPython());

    return result;
  }
SWIGINTERN PyObject *nupic_algorithms_Cells4_Cells4_getLearnStates(nupic::algorithms::Cells4::Cells4 const *self){
    nupic::UInt32 nCells = self->nCells();

    nupic::Byte* cpp_activeT, *cpp_activeT1;
    nupic::Byte* cpp_predT, *cpp_predT1;

    self->getLearnStatePointers(cpp_activeT, cpp_activeT1,
                           cpp_predT, cpp_predT1);

    nupic::NumpyVectorT<nupic::Byte> activeT(nCells, cpp_activeT);
    nupic::NumpyVectorT<nupic::Byte> activeT1(nCells, cpp_activeT1);
    nupic::NumpyVectorT<nupic::Byte> predT(nCells, cpp_predT);
    nupic::NumpyVectorT<nupic::Byte> predT1(nCells, cpp_predT1);

    PyObject *result = PyTuple_New(4);
    PyTuple_SET_ITEM(result, 0, activeT.forPython());
    PyTuple_SET_ITEM(result, 1, activeT1.forPython());
    PyTuple_SET_ITEM(result, 2, predT.forPython());
    PyTuple_SET_ITEM(result, 3, predT1.forPython());

    return result;
  }
SWIGINTERN PyObject *nupic_algorithms_Cells4_Cells4_compute__SWIG_1(nupic::algorithms::Cells4::Cells4 *self,PyObject *py_x,bool doInference,bool doLearning){
    PyArrayObject* x = (PyArrayObject*) py_x;
    nupic::NumpyVectorT<nupic::Real32> y(self->nCells());
    self->compute((nupic::Real32*) x->data, y.begin(), doInference, doLearning);
    return y.forPython();
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_compute__SWIG_2(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x,bool learn,PyObject *py_y){
    PyArrayObject* x = (PyArrayObject*) py_x;
    PyArrayObject* y = (PyArrayObject*) py_y;
    self->compute((nupic::UInt*) x->data, (bool)learn, (nupic::UInt*) y->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_stripUnlearnedColumns__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->stripUnlearnedColumns((nupic::UInt*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_write__SWIG_2(nupic::algorithms::spatial_pooler::SpatialPooler const *self,PyObject *pyBuilder){
    SpatialPoolerProto::Builder proto =
        getBuilder<SpatialPoolerProto>(pyBuilder);
    self->write(proto);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_read__SWIG_2(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *pyReader){
    SpatialPoolerProto::Reader proto = getReader<SpatialPoolerProto>(pyReader);
    self->read(proto);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_loadFromString(nupic::algorithms::spatial_pooler::SpatialPooler *self,std::string const &inString){
    std::istringstream inStream(inString);
    self->load(inStream);
  }
SWIGINTERN PyObject *nupic_algorithms_spatial_pooler_SpatialPooler_getCState(nupic::algorithms::spatial_pooler::SpatialPooler *self){
    SharedPythonOStream py_s(self->persistentSize());
    std::ostream& s = py_s.getStream();
    // TODO: Consider writing floats as binary instead.
    s.flags(ios::scientific);
    s.precision(numeric_limits<double>::digits10 + 1);
    self->save(s);
    return py_s.close();
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setBoostFactors__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setBoostFactors((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getBoostFactors__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getBoostFactors((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setOverlapDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setOverlapDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getOverlapDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getOverlapDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setActiveDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setActiveDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getActiveDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getActiveDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setMinOverlapDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setMinOverlapDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getMinOverlapDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getMinOverlapDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setMinActiveDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setMinActiveDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getMinActiveDutyCycles__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getMinActiveDutyCycles((nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setPotential__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,nupic::UInt column,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setPotential(column, (nupic::UInt*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getPotential__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,nupic::UInt column,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getPotential(column, (nupic::UInt*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_setPermanence__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,nupic::UInt column,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->setPermanence(column, (nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getPermanence__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,nupic::UInt column,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getPermanence(column, (nupic::Real*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getConnectedSynapses__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,nupic::UInt column,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getConnectedSynapses(column, (nupic::UInt*) x->data);
  }
SWIGINTERN void nupic_algorithms_spatial_pooler_SpatialPooler_getConnectedCounts__SWIG_1(nupic::algorithms::spatial_pooler::SpatialPooler *self,PyObject *py_x){
    PyArrayObject* x = (PyArrayObject*) py_x;
    self->getConnectedCounts((nupic::UInt*) x->data);
  }
SWIGINTERN void nupic_algorithms_cla_classifier_FastCLAClassifier_loadFromString(nupic::algorithms::cla_classifier::FastCLAClassifier *self,std::string const &inString){
    std::istringstream inStream(inString);
    self->load(inStream);
  }
SWIGINTERN PyObject *nupic_algorithms_cla_classifier_FastCLAClassifier_getCState(nupic::algorithms::cla_classifier::FastCLAClassifier *self){
    SharedPythonOStream py_s(self->persistentSize());
    std::ostream& s = py_s.getStream();
    // TODO: Consider writing floats as binary instead.
    s.flags(ios::scientific);
    s.precision(numeric_limits<double>::digits10 + 1);
    self->save(s);
    return py_s.close();
  }
SWIGINTERN PyObject *nupic_algorithms_cla_classifier_FastCLAClassifier_convertedCompute(nupic::algorithms::cla_classifier::FastCLAClassifier *self,nupic::UInt recordNum,std::vector< nupic::UInt > const &patternNZ,nupic::UInt bucketIdx,nupic::Real64 actValue,bool category,bool learn,bool infer){
    ClassifierResult result;
    self->fastCompute(recordNum, patternNZ, bucketIdx, actValue, category,
                      learn, infer, &result);
    PyObject* d = PyDict_New();
    for (map<Int, vector<Real64>*>::const_iterator it = result.begin();
         it != result.end(); ++it)
    {
      PyObject* key;
      if (it->first == -1)
      {
        key = PyString_FromString("actualValues");
      } else {
        key = PyInt_FromLong(it->first);
      }

      PyObject* value = PyList_New(it->second->size());
      for (UInt i = 0; i < it->second->size(); ++i)
      {
        PyObject* pyActValue = PyFloat_FromDouble(it->second->at(i));
        PyList_SetItem(value, i, pyActValue);
      }

      PyDict_SetItem(d, key, value);
      Py_DECREF(value);
    }
    return d;
  }
SWIGINTERN swig::SwigPyIterator *vector_Sl_nupic_algorithms_connections_Synapse_Sg__iterator(vector< nupic::algorithms::connections::Synapse > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Synapse_Sg____nonzero__(vector< nupic::algorithms::connections::Synapse > const *self){
      return !(self->empty());
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Synapse_Sg____bool__(vector< nupic::algorithms::connections::Synapse > const *self){
      return !(self->empty());
    }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::size_type vector_Sl_nupic_algorithms_connections_Synapse_Sg____len__(vector< nupic::algorithms::connections::Synapse > const *self){
      return self->size();
    }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::value_type vector_Sl_nupic_algorithms_connections_Synapse_Sg__pop(vector< nupic::algorithms::connections::Synapse > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *vector_Sl_nupic_algorithms_connections_Synapse_Sg____getslice__(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::difference_type i,vector< nupic::algorithms::connections::Synapse >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }

  namespace swig {
    template <>  struct traits<nupic::algorithms::connections::Synapse > {
      typedef pointer_category category;
      static const char* type_name() { return"nupic::algorithms::connections::Synapse"; }
    };
  }


      namespace swig {
	template <>  struct traits<std::vector<nupic::algorithms::connections::Synapse, std::allocator< nupic::algorithms::connections::Synapse > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "nupic::algorithms::connections::Synapse" "," "std::allocator< nupic::algorithms::connections::Synapse >" " >";
	  }
	};
      }
    
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____setslice__(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::difference_type i,vector< nupic::algorithms::connections::Synapse >::difference_type j,std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &v=std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____delslice__(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::difference_type i,vector< nupic::algorithms::connections::Synapse >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____delitem____SWIG_0(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *vector_Sl_nupic_algorithms_connections_Synapse_Sg____getitem____SWIG_0(vector< nupic::algorithms::connections::Synapse > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return NULL;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_0(vector< nupic::algorithms::connections::Synapse > *self,PySliceObject *slice,std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &v){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_1(vector< nupic::algorithms::connections::Synapse > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____delitem____SWIG_1(vector< nupic::algorithms::connections::Synapse > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::value_type const &vector_Sl_nupic_algorithms_connections_Synapse_Sg____getitem____SWIG_1(vector< nupic::algorithms::connections::Synapse > const *self,vector< nupic::algorithms::connections::Synapse >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_2(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::difference_type i,vector< nupic::algorithms::connections::Synapse >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg__append(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::iterator vector_Sl_nupic_algorithms_connections_Synapse_Sg__erase__SWIG_0(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::iterator pos){ return self->erase(pos); }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::iterator vector_Sl_nupic_algorithms_connections_Synapse_Sg__erase__SWIG_1(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::iterator first,vector< nupic::algorithms::connections::Synapse >::iterator last){ return self->erase(first, last); }
SWIGINTERN vector< nupic::algorithms::connections::Synapse >::iterator vector_Sl_nupic_algorithms_connections_Synapse_Sg__insert__SWIG_0(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::iterator pos,vector< nupic::algorithms::connections::Synapse >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Synapse_Sg__insert__SWIG_1(vector< nupic::algorithms::connections::Synapse > *self,vector< nupic::algorithms::connections::Synapse >::iterator pos,vector< nupic::algorithms::connections::Synapse >::size_type n,vector< nupic::algorithms::connections::Synapse >::value_type const &x){ self->insert(pos, n, x); }
SWIGINTERN swig::SwigPyIterator *vector_Sl_nupic_algorithms_connections_Segment_Sg__iterator(vector< nupic::algorithms::connections::Segment > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Segment_Sg____nonzero__(vector< nupic::algorithms::connections::Segment > const *self){
      return !(self->empty());
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Segment_Sg____bool__(vector< nupic::algorithms::connections::Segment > const *self){
      return !(self->empty());
    }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::size_type vector_Sl_nupic_algorithms_connections_Segment_Sg____len__(vector< nupic::algorithms::connections::Segment > const *self){
      return self->size();
    }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::value_type vector_Sl_nupic_algorithms_connections_Segment_Sg__pop(vector< nupic::algorithms::connections::Segment > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *vector_Sl_nupic_algorithms_connections_Segment_Sg____getslice__(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::difference_type i,vector< nupic::algorithms::connections::Segment >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }

  namespace swig {
    template <>  struct traits<nupic::algorithms::connections::Segment > {
      typedef pointer_category category;
      static const char* type_name() { return"nupic::algorithms::connections::Segment"; }
    };
  }


      namespace swig {
	template <>  struct traits<std::vector<nupic::algorithms::connections::Segment, std::allocator< nupic::algorithms::connections::Segment > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "nupic::algorithms::connections::Segment" "," "std::allocator< nupic::algorithms::connections::Segment >" " >";
	  }
	};
      }
    
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____setslice__(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::difference_type i,vector< nupic::algorithms::connections::Segment >::difference_type j,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &v=std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____delslice__(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::difference_type i,vector< nupic::algorithms::connections::Segment >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____delitem____SWIG_0(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *vector_Sl_nupic_algorithms_connections_Segment_Sg____getitem____SWIG_0(vector< nupic::algorithms::connections::Segment > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return NULL;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_0(vector< nupic::algorithms::connections::Segment > *self,PySliceObject *slice,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &v){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_1(vector< nupic::algorithms::connections::Segment > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____delitem____SWIG_1(vector< nupic::algorithms::connections::Segment > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::value_type const &vector_Sl_nupic_algorithms_connections_Segment_Sg____getitem____SWIG_1(vector< nupic::algorithms::connections::Segment > const *self,vector< nupic::algorithms::connections::Segment >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_2(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::difference_type i,vector< nupic::algorithms::connections::Segment >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg__append(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::iterator vector_Sl_nupic_algorithms_connections_Segment_Sg__erase__SWIG_0(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::iterator pos){ return self->erase(pos); }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::iterator vector_Sl_nupic_algorithms_connections_Segment_Sg__erase__SWIG_1(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::iterator first,vector< nupic::algorithms::connections::Segment >::iterator last){ return self->erase(first, last); }
SWIGINTERN vector< nupic::algorithms::connections::Segment >::iterator vector_Sl_nupic_algorithms_connections_Segment_Sg__insert__SWIG_0(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::iterator pos,vector< nupic::algorithms::connections::Segment >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Segment_Sg__insert__SWIG_1(vector< nupic::algorithms::connections::Segment > *self,vector< nupic::algorithms::connections::Segment >::iterator pos,vector< nupic::algorithms::connections::Segment >::size_type n,vector< nupic::algorithms::connections::Segment >::value_type const &x){ self->insert(pos, n, x); }
SWIGINTERN swig::SwigPyIterator *vector_Sl_nupic_algorithms_connections_Cell_Sg__iterator(vector< nupic::algorithms::connections::Cell > *self,PyObject **PYTHON_SELF){
      return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Cell_Sg____nonzero__(vector< nupic::algorithms::connections::Cell > const *self){
      return !(self->empty());
    }
SWIGINTERN bool vector_Sl_nupic_algorithms_connections_Cell_Sg____bool__(vector< nupic::algorithms::connections::Cell > const *self){
      return !(self->empty());
    }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::size_type vector_Sl_nupic_algorithms_connections_Cell_Sg____len__(vector< nupic::algorithms::connections::Cell > const *self){
      return self->size();
    }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::value_type vector_Sl_nupic_algorithms_connections_Cell_Sg__pop(vector< nupic::algorithms::connections::Cell > *self){
      if (self->size() == 0)
	throw std::out_of_range("pop from empty container");
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::value_type x = self->back();
      self->pop_back();
      return x;
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *vector_Sl_nupic_algorithms_connections_Cell_Sg____getslice__(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::difference_type i,vector< nupic::algorithms::connections::Cell >::difference_type j){
      return swig::getslice(self, i, j, 1);
    }

  namespace swig {
    template <>  struct traits<nupic::algorithms::connections::Cell > {
      typedef pointer_category category;
      static const char* type_name() { return"nupic::algorithms::connections::Cell"; }
    };
  }


      namespace swig {
	template <>  struct traits<std::vector<nupic::algorithms::connections::Cell, std::allocator< nupic::algorithms::connections::Cell > > > {
	  typedef pointer_category category;
	  static const char* type_name() {
	    return "std::vector<" "nupic::algorithms::connections::Cell" "," "std::allocator< nupic::algorithms::connections::Cell >" " >";
	  }
	};
      }
    
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____setslice__(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::difference_type i,vector< nupic::algorithms::connections::Cell >::difference_type j,std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &v=std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >()){
      swig::setslice(self, i, j, 1, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____delslice__(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::difference_type i,vector< nupic::algorithms::connections::Cell >::difference_type j){
      swig::delslice(self, i, j, 1);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____delitem____SWIG_0(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::difference_type i){
      self->erase(swig::getpos(self,i));
    }
SWIGINTERN std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *vector_Sl_nupic_algorithms_connections_Cell_Sg____getitem____SWIG_0(vector< nupic::algorithms::connections::Cell > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return NULL;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type jd = j;
      return swig::getslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_0(vector< nupic::algorithms::connections::Cell > *self,PySliceObject *slice,std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &v){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type jd = j;
      swig::setslice(self, id, jd, step, v);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_1(vector< nupic::algorithms::connections::Cell > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____delitem____SWIG_1(vector< nupic::algorithms::connections::Cell > *self,PySliceObject *slice){
      Py_ssize_t i, j, step;
      if( !PySlice_Check(slice) ) {
        SWIG_Error(SWIG_TypeError, "Slice object expected.");
        return;
      }
      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type id = i;
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >::difference_type jd = j;
      swig::delslice(self, id, jd, step);
    }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::value_type const &vector_Sl_nupic_algorithms_connections_Cell_Sg____getitem____SWIG_1(vector< nupic::algorithms::connections::Cell > const *self,vector< nupic::algorithms::connections::Cell >::difference_type i){
      return *(swig::cgetpos(self, i));
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_2(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::difference_type i,vector< nupic::algorithms::connections::Cell >::value_type const &x){
      *(swig::getpos(self,i)) = x;
    }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg__append(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::value_type const &x){
      self->push_back(x);
    }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::iterator vector_Sl_nupic_algorithms_connections_Cell_Sg__erase__SWIG_0(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::iterator pos){ return self->erase(pos); }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::iterator vector_Sl_nupic_algorithms_connections_Cell_Sg__erase__SWIG_1(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::iterator first,vector< nupic::algorithms::connections::Cell >::iterator last){ return self->erase(first, last); }
SWIGINTERN vector< nupic::algorithms::connections::Cell >::iterator vector_Sl_nupic_algorithms_connections_Cell_Sg__insert__SWIG_0(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::iterator pos,vector< nupic::algorithms::connections::Cell >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void vector_Sl_nupic_algorithms_connections_Cell_Sg__insert__SWIG_1(vector< nupic::algorithms::connections::Cell > *self,vector< nupic::algorithms::connections::Cell >::iterator pos,vector< nupic::algorithms::connections::Cell >::size_type n,vector< nupic::algorithms::connections::Cell >::value_type const &x){ self->insert(pos, n, x); }

SWIGINTERN int
SWIG_AsVal_unsigned_SS_char (PyObject * obj, unsigned char *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v > UCHAR_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< unsigned char >(v);
    }
  }  
  return res;
}


SWIGINTERNINLINE PyObject *
SWIG_From_unsigned_SS_char  (unsigned char value)
{    
  return SWIG_From_unsigned_SS_long  (value);
}

#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_forceRetentionOfGaborComputeWithinLibrary(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args,"forceRetentionOfGaborComputeWithinLibrary",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      forceRetentionOfGaborComputeWithinLibrary();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_forceRetentionOfImageSensorLiteLibrary(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args,"forceRetentionOfImageSensorLiteLibrary",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      forceRetentionOfImageSensorLiteLibrary();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_feature_node_index_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *arg1 = (nupic::algorithms::linear::feature_node *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"feature_node_index_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "feature_node_index_set" "', argument " "1"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "feature_node_index_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->index = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_feature_node_index_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *arg1 = (nupic::algorithms::linear::feature_node *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "feature_node_index_get" "', argument " "1"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp1);
  result = (int) ((arg1)->index);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_feature_node_value_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *arg1 = (nupic::algorithms::linear::feature_node *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"feature_node_value_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "feature_node_value_set" "', argument " "1"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->value = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_feature_node_value_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *arg1 = (nupic::algorithms::linear::feature_node *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "feature_node_value_get" "', argument " "1"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp1);
  result = (float) ((arg1)->value);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_feature_node(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_feature_node",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::feature_node *)new nupic::algorithms::linear::feature_node();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__feature_node, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_feature_node(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::feature_node *arg1 = (nupic::algorithms::linear::feature_node *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__feature_node, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_feature_node" "', argument " "1"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *feature_node_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__feature_node, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_sparse_feature_vector_data_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::sparse_feature_vector *arg1 = (nupic::algorithms::linear::sparse_feature_vector *) 0 ;
  nupic::algorithms::linear::feature_node *arg2 = (nupic::algorithms::linear::feature_node *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"sparse_feature_vector_data_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sparse_feature_vector_data_set" "', argument " "1"" of type '" "nupic::algorithms::linear::sparse_feature_vector *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::sparse_feature_vector * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nupic__algorithms__linear__feature_node, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sparse_feature_vector_data_set" "', argument " "2"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp2);
  if (arg1) (arg1)->data = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sparse_feature_vector_data_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::sparse_feature_vector *arg1 = (nupic::algorithms::linear::sparse_feature_vector *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::feature_node *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sparse_feature_vector_data_get" "', argument " "1"" of type '" "nupic::algorithms::linear::sparse_feature_vector *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::sparse_feature_vector * >(argp1);
  result = (nupic::algorithms::linear::feature_node *) ((arg1)->data);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_sparse_feature_vector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::sparse_feature_vector *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::sparse_feature_vector *)new nupic::algorithms::linear::sparse_feature_vector();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_sparse_feature_vector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  float *arg2 = (float *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  nupic::algorithms::linear::sparse_feature_vector *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_sparse_feature_vector" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_sparse_feature_vector" "', argument " "2"" of type '" "float const *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::sparse_feature_vector *)new nupic::algorithms::linear::sparse_feature_vector(arg1,(float const *)arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_sparse_feature_vector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_sparse_feature_vector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_sparse_feature_vector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_sparse_feature_vector__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_sparse_feature_vector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::sparse_feature_vector::sparse_feature_vector()\n"
    "    nupic::algorithms::linear::sparse_feature_vector::sparse_feature_vector(int,float const *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_sparse_feature_vector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::sparse_feature_vector *arg1 = (nupic::algorithms::linear::sparse_feature_vector *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_sparse_feature_vector" "', argument " "1"" of type '" "nupic::algorithms::linear::sparse_feature_vector *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::sparse_feature_vector * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *sparse_feature_vector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__sparse_feature_vector, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  float arg3 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "l_",(char *) "n_",(char *) "bias_", NULL 
  };
  nupic::algorithms::linear::problem *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:new_problem",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_problem" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_problem" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::problem *)new nupic::algorithms::linear::problem(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__problem, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_problem" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_l_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"problem_l_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_l_set" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "problem_l_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->l = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_l_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_l_get" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  result = (int) ((arg1)->l);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_n_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"problem_n_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_n_set" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "problem_n_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->n = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_n_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_n_get" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  result = (int) ((arg1)->n);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_bias_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"problem_bias_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_bias_set" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->bias = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_bias_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_bias_get" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  result = (float) ((arg1)->bias);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_y_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  int *arg2 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"problem_y_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_y_set" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "problem_y_set" "', argument " "2"" of type '" "int *""'"); 
  }
  arg2 = reinterpret_cast< int * >(argp2);
  if (arg1) (arg1)->y = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_y_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_y_get" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  result = (int *) ((arg1)->y);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_x_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  nupic::algorithms::linear::feature_node **arg2 = (nupic::algorithms::linear::feature_node **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"problem_x_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_x_set" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "problem_x_set" "', argument " "2"" of type '" "nupic::algorithms::linear::feature_node **""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::feature_node ** >(argp2);
  if (arg1) (arg1)->x = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_problem_x_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::problem *arg1 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::feature_node **result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "problem_x_get" "', argument " "1"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp1);
  result = (nupic::algorithms::linear::feature_node **) ((arg1)->x);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *problem_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__problem, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_parameter__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::parameter *)new nupic::algorithms::linear::parameter();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__parameter, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_parameter__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  float arg2 ;
  float arg3 ;
  int arg4 = (int) 0 ;
  int *arg5 = (int *) nullptr ;
  float *arg6 = (float *) nullptr ;
  int val1 ;
  int ecode1 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  nupic::algorithms::linear::parameter *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 6)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_parameter" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
  }
  if (swig_obj[3]) {
    ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_parameter" "', argument " "4"" of type '" "int""'");
    } 
    arg4 = static_cast< int >(val4);
  }
  if (swig_obj[4]) {
    res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_parameter" "', argument " "5"" of type '" "int *""'"); 
    }
    arg5 = reinterpret_cast< int * >(argp5);
  }
  if (swig_obj[5]) {
    res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_float, 0 |  0 );
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_parameter" "', argument " "6"" of type '" "float *""'"); 
    }
    arg6 = reinterpret_cast< float * >(argp6);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::parameter *)new nupic::algorithms::linear::parameter(arg1,arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__parameter, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_parameter(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_parameter",0,6,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if ((argc >= 3) && (argc <= 6)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 3) {
        {
          {
            int res = SWIG_AsVal_int(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
        if (argc > 4) {
          {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_int, 0);
            _v = SWIG_CheckState(res);
          }
          if (!_v) goto check_2;
          _ranki += _v*_pi;
          _rankm += _pi;
          _pi *= SWIG_MAXCASTRANK;
          if (argc > 5) {
            {
              void *vptr = 0;
              int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_float, 0);
              _v = SWIG_CheckState(res);
            }
            if (!_v) goto check_2;
            _ranki += _v*_pi;
            _rankm += _pi;
            _pi *= SWIG_MAXCASTRANK;
          }
        }
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_parameter__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_parameter__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_parameter'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::parameter::parameter()\n"
    "    nupic::algorithms::linear::parameter::parameter(int,float,float,int,int *,float *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_parameter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_parameter" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_solver_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_solver_type_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_solver_type_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "parameter_solver_type_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->solver_type = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_solver_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_solver_type_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (int) ((arg1)->solver_type);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_eps_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_eps_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_eps_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->eps = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_eps_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_eps_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (float) ((arg1)->eps);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_C_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_C_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_C_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->C = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_C_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_C_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (float) ((arg1)->C);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_nr_weight_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_nr_weight_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_nr_weight_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "parameter_nr_weight_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->nr_weight = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_nr_weight_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_nr_weight_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (int) ((arg1)->nr_weight);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_weight_label_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  int *arg2 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_weight_label_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_weight_label_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "parameter_weight_label_set" "', argument " "2"" of type '" "int *""'"); 
  }
  arg2 = reinterpret_cast< int * >(argp2);
  if (arg1) (arg1)->weight_label = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_weight_label_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_weight_label_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (int *) ((arg1)->weight_label);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_weight_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"parameter_weight_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_weight_set" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "parameter_weight_set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->weight = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_parameter_weight_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::parameter *arg1 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "parameter_weight_get" "', argument " "1"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp1);
  result = (float *) ((arg1)->weight);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *parameter_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__parameter, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_model",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::model *)new nupic::algorithms::linear::model();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__model, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_model" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_get_labels(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  int *arg2 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "label", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:model_get_labels",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_get_labels" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "model_get_labels" "', argument " "2"" of type '" "int *""'"); 
  }
  arg2 = reinterpret_cast< int * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->get_labels(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_param_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  nupic::algorithms::linear::parameter *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_param_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_param_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__linear__parameter,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "model_param_set" "', argument " "2"" of type '" "nupic::algorithms::linear::parameter const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "model_param_set" "', argument " "2"" of type '" "nupic::algorithms::linear::parameter const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp2);
  if (arg1) (arg1)->param = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_param_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::parameter *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_param_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (nupic::algorithms::linear::parameter *) & ((arg1)->param);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_nr_class_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_nr_class_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_nr_class_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "model_nr_class_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->nr_class = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_nr_class_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_nr_class_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (int) ((arg1)->nr_class);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_nr_feature_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_nr_feature_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_nr_feature_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "model_nr_feature_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->nr_feature = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_nr_feature_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_nr_feature_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (int) ((arg1)->nr_feature);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_w_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_w_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_w_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "model_w_set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->w = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_w_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_w_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (float *) ((arg1)->w);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_label_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  int *arg2 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_label_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_label_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "model_label_set" "', argument " "2"" of type '" "int *""'"); 
  }
  arg2 = reinterpret_cast< int * >(argp2);
  if (arg1) (arg1)->label = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_label_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_label_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (int *) ((arg1)->label);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_int, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_bias_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"model_bias_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_bias_set" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->bias = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_model_bias_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::model *arg1 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "model_bias_get" "', argument " "1"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::model * >(argp1);
  result = (float) ((arg1)->bias);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *model_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__model, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_function_fun(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "w", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:function_fun",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "function_fun" "', argument " "1"" of type '" "nupic::algorithms::linear::function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "function_fun" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)(arg1)->fun(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_function_grad(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "w",(char *) "g", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:function_grad",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "function_grad" "', argument " "1"" of type '" "nupic::algorithms::linear::function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "function_grad" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "function_grad" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->grad(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_function_Hv(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "s",(char *) "Hs", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:function_Hv",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "function_Hv" "', argument " "1"" of type '" "nupic::algorithms::linear::function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "function_Hv" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "function_Hv" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->Hv(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_function_get_nr_variable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "function_get_nr_variable" "', argument " "1"" of type '" "nupic::algorithms::linear::function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)(arg1)->get_nr_variable();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_function(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_function" "', argument " "1"" of type '" "nupic::algorithms::linear::function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *function_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__function, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_TRON(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::function *arg1 = (nupic::algorithms::linear::function *) 0 ;
  float arg2 = (float) 0.1 ;
  int arg3 = (int) 1000 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "fun_obj",(char *) "eps",(char *) "max_iter", NULL 
  };
  nupic::algorithms::linear::TRON *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:new_TRON",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TRON" "', argument " "1"" of type '" "nupic::algorithms::linear::function const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::function * >(argp1);
  if (obj1) {
    {
      arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
    }
  }
  if (obj2) {
    ecode3 = SWIG_AsVal_int(obj2, &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_TRON" "', argument " "3"" of type '" "int""'");
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::TRON *)new nupic::algorithms::linear::TRON((nupic::algorithms::linear::function const *)arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__TRON, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_TRON(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::TRON *arg1 = (nupic::algorithms::linear::TRON *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__TRON, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_TRON" "', argument " "1"" of type '" "nupic::algorithms::linear::TRON *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::TRON * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_TRON_tron(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::TRON *arg1 = (nupic::algorithms::linear::TRON *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "w", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:TRON_tron",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__TRON, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TRON_tron" "', argument " "1"" of type '" "nupic::algorithms::linear::TRON *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::TRON * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TRON_tron" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->tron(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *TRON_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__TRON, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_linear(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 ;
  float arg2 ;
  float arg3 ;
  int arg4 = (int) 0 ;
  int *arg5 = (int *) nullptr ;
  float *arg6 = (float *) nullptr ;
  int val1 ;
  int ecode1 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "solver_type",(char *) "eps",(char *) "C",(char *) "nr_weight",(char *) "weight_label",(char *) "weight", NULL 
  };
  nupic::algorithms::linear::linear *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OOO:new_linear",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_linear" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_int(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_linear" "', argument " "4"" of type '" "int""'");
    } 
    arg4 = static_cast< int >(val4);
  }
  if (obj4) {
    res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_int, 0 |  0 );
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_linear" "', argument " "5"" of type '" "int *""'"); 
    }
    arg5 = reinterpret_cast< int * >(argp5);
  }
  if (obj5) {
    res6 = SWIG_ConvertPtr(obj5, &argp6,SWIGTYPE_p_float, 0 |  0 );
    if (!SWIG_IsOK(res6)) {
      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_linear" "', argument " "6"" of type '" "float *""'"); 
    }
    arg6 = reinterpret_cast< float * >(argp6);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::linear::linear *)new nupic::algorithms::linear::linear(arg1,arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__linear, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_linear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_linear" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_x_space_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  nupic::algorithms::linear::feature_node *arg2 = (nupic::algorithms::linear::feature_node *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"linear_x_space_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_x_space_set" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nupic__algorithms__linear__feature_node, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_x_space_set" "', argument " "2"" of type '" "nupic::algorithms::linear::feature_node *""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::feature_node * >(argp2);
  if (arg1) (arg1)->x_space = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_x_space_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::feature_node *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_x_space_get" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  result = (nupic::algorithms::linear::feature_node *) ((arg1)->x_space);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__feature_node, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_param_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  nupic::algorithms::linear::parameter *arg2 = (nupic::algorithms::linear::parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"linear_the_param_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_param_set" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nupic__algorithms__linear__parameter, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_the_param_set" "', argument " "2"" of type '" "nupic::algorithms::linear::parameter *""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::parameter * >(argp2);
  if (arg1) (arg1)->the_param = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_param_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::parameter *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_param_get" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  result = (nupic::algorithms::linear::parameter *) ((arg1)->the_param);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__parameter, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_problem_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  nupic::algorithms::linear::problem *arg2 = (nupic::algorithms::linear::problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"linear_the_problem_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_problem_set" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nupic__algorithms__linear__problem, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_the_problem_set" "', argument " "2"" of type '" "nupic::algorithms::linear::problem *""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::problem * >(argp2);
  if (arg1) (arg1)->the_problem = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_problem_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::problem *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_problem_get" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  result = (nupic::algorithms::linear::problem *) ((arg1)->the_problem);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__problem, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_model_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  nupic::algorithms::linear::model *arg2 = (nupic::algorithms::linear::model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"linear_the_model_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_model_set" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nupic__algorithms__linear__model, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_the_model_set" "', argument " "2"" of type '" "nupic::algorithms::linear::model *""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::linear::model * >(argp2);
  if (arg1) (arg1)->the_model = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_the_model_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::linear::model *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_the_model_get" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  result = (nupic::algorithms::linear::model *) ((arg1)->the_model);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__linear__model, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_create_problem__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  int arg2 ;
  int arg3 ;
  float *arg4 = (float *) 0 ;
  float *arg5 = (float *) 0 ;
  float arg6 = (float) -1.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  
  if ((nobjs < 5) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_create_problem" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "linear_create_problem" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "linear_create_problem" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "linear_create_problem" "', argument " "4"" of type '" "float *""'"); 
  }
  arg4 = reinterpret_cast< float * >(argp4);
  res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "linear_create_problem" "', argument " "5"" of type '" "float *""'"); 
  }
  arg5 = reinterpret_cast< float * >(argp5);
  if (swig_obj[5]) {
    {
      arg6 = (nupic::Real32) PyFloat_AsDouble(swig_obj[5]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->create_problem(arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_train(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_train" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->train();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_cross_validation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  int arg2 ;
  int *arg3 = (int *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_cross_validation" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "linear_cross_validation" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "linear_cross_validation" "', argument " "3"" of type '" "int *""'"); 
  }
  arg3 = reinterpret_cast< int * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->cross_validation(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict_values__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict_values" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_predict_values" "', argument " "2"" of type '" "float const *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "linear_predict_values" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)(arg1)->predict_values((float const *)arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_predict" "', argument " "2"" of type '" "float const *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)(arg1)->predict((float const *)arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict_probability__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict_probability" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_predict_probability" "', argument " "2"" of type '" "float const *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "linear_predict_probability" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)(arg1)->predict_probability((float const *)arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_save_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "model_file_name", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:linear_save_model",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_save_model" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_save_model" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)(arg1)->save_model((char const *)arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_load_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "model_file_name", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:linear_load_model",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_load_model" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "linear_load_model" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load_model((char const *)arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_create_problem__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  int arg2 ;
  int arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  PyObject *arg5 = (PyObject *) 0 ;
  float arg6 = (float) -1.0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 5) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_create_problem" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "linear_create_problem" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "linear_create_problem" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  arg4 = swig_obj[3];
  arg5 = swig_obj[4];
  if (swig_obj[5]) {
    {
      arg6 = (nupic::Real32) PyFloat_AsDouble(swig_obj[5]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_linear_linear_create_problem__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_create_problem(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"linear_create_problem",0,6,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 5) && (argc <= 6)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 5) {
        {
          {
            int res = SWIG_AsVal_float(argv[5], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_1;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if ((argc >= 5) && (argc <= 6)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[3] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[4] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 5) {
        {
          {
            int res = SWIG_AsVal_float(argv[5], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_linear_create_problem__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_linear_create_problem__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'linear_create_problem'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::linear::create_problem(int,int,float *,float *,float)\n"
    "    nupic::algorithms::linear::linear::create_problem(int,int,PyObject *,PyObject *,float)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_linear_cross_validation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  int arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_cross_validation" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "linear_cross_validation" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_linear_linear_cross_validation__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_cross_validation(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"linear_cross_validation",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_linear_cross_validation__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_linear_cross_validation__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'linear_cross_validation'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::linear::cross_validation(int,int *)\n"
    "    nupic::algorithms::linear::linear::cross_validation(int,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_linear_predict_values__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict_values" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)nupic_algorithms_linear_linear_predict_values__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict_values(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"linear_predict_values",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_linear_predict_values__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_linear_predict_values__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'linear_predict_values'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::linear::predict_values(float const *,float *)\n"
    "    nupic::algorithms::linear::linear::predict_values(PyObject *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_linear_predict__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)nupic_algorithms_linear_linear_predict__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"linear_predict",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_linear_predict__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_linear_predict__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'linear_predict'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::linear::predict(float const *)\n"
    "    nupic::algorithms::linear::linear::predict(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_linear_predict_probability__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::linear::linear *arg1 = (nupic::algorithms::linear::linear *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__linear__linear, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "linear_predict_probability" "', argument " "1"" of type '" "nupic::algorithms::linear::linear *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::linear::linear * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)nupic_algorithms_linear_linear_predict_probability__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_linear_predict_probability(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"linear_predict_probability",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__linear__linear, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_linear_predict_probability__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_linear_predict_probability__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'linear_predict_probability'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::linear::linear::predict_probability(float const *,float *)\n"
    "    nupic::algorithms::linear::linear::predict_probability(PyObject *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *linear_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__linear__linear, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_svm_problem_recover__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem_recover__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_recover__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_recover__set" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (arg1) (arg1)->recover_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_recover__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_recover__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  result = (bool) ((arg1)->recover_);
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_n_dims__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem_n_dims__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_n_dims__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_n_dims__set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->n_dims_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_n_dims__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_n_dims__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  result = (int) ((arg1)->n_dims_);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_x__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem_x__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_x__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem_x__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem_x__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > * >(argp2);
  if (arg1) (arg1)->x_ = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_x__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_x__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  result = (std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > *) & ((arg1)->x_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_y__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  std::vector< nupic::algorithms::svm::svm_problem::label_type,std::allocator< nupic::algorithms::svm::svm_problem::label_type > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem_y__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_y__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem_y__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem::label_type,std::allocator< nupic::algorithms::svm::svm_problem::label_type > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem_y__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem::label_type,std::allocator< nupic::algorithms::svm::svm_problem::label_type > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->y_ = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_y__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::algorithms::svm::svm_problem::label_type,std::allocator< nupic::algorithms::svm::svm_problem::label_type > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_y__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  result = (std::vector< nupic::algorithms::svm::svm_problem::label_type,std::allocator< nupic::algorithms::svm::svm_problem::label_type > > *) & ((arg1)->y_);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  bool arg2 ;
  float arg3 = (float) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  nupic::algorithms::svm::svm_problem *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 3)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_problem" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_problem" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (swig_obj[2]) {
    {
      arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem *)new nupic::algorithms::svm::svm_problem(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  bool arg3 ;
  float arg4 = (float) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  nupic::algorithms::svm::svm_problem *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 4)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_problem" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_problem" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_svm_problem" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  if (swig_obj[3]) {
    {
      arg4 = (nupic::Real32) PyFloat_AsDouble(swig_obj[3]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem *)new nupic::algorithms::svm::svm_problem(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::svm::svm_problem *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_svm_problem" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_svm_problem" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  arg1 = reinterpret_cast< std::istream * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem *)new nupic::algorithms::svm::svm_problem(*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_svm_problem",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if ((argc >= 2) && (argc <= 3)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 2) {
        {
          {
            int res = SWIG_AsVal_float(argv[2], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if ((argc >= 3) && (argc <= 4)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 3) {
        {
          {
            int res = SWIG_AsVal_float(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_3;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_svm_problem__SWIG_2(self, argc, argv);
    case 2:
      return _wrap_new_svm_problem__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_new_svm_problem__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_svm_problem'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_problem::svm_problem(int,bool,float)\n"
    "    nupic::algorithms::svm::svm_problem::svm_problem(int,int,bool,float)\n"
    "    nupic::algorithms::svm::svm_problem::svm_problem(std::istream &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_svm_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_problem" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_n_dims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_n_dims" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem const *)arg1)->n_dims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_nnz(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_nnz",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_nnz" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_nnz" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem const *)arg1)->nnz(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_resize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_resize",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_resize" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_resize" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_set_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  nupic::algorithms::svm::svm_problem::sample_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "s", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_problem_set_sample",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_set_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_set_sample" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_float_t,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "svm_problem_set_sample" "', argument " "3"" of type '" "nupic::algorithms::svm::svm_problem::sample_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem_set_sample" "', argument " "3"" of type '" "nupic::algorithms::svm::svm_problem::sample_type const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::svm::svm_problem::sample_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set_sample(arg2,(nupic::algorithms::svm::svm_problem::sample_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_get_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i", NULL 
  };
  SwigValueWrapper< nupic::algorithms::svm::sample< float,float > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_get_sample",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_get_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_get_sample" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::svm::svm_problem const *)arg1)->get_sample(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::svm::svm_problem::sample_type(static_cast< const nupic::algorithms::svm::svm_problem::sample_type& >(result))), SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_float_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_dense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  int arg2 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "sv", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_problem_dense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_dense" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem_dense" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "svm_problem_dense" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_problem const *)arg1)->dense(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_problem const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem_get_samples(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = (nupic::algorithms::svm::svm_problem *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "samplesIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem_get_samples",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem_get_samples" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_problem_get_samples(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_problem_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_problem, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_svm_problem01_recover__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_recover__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_recover__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_recover__set" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (arg1) (arg1)->recover_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_recover__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_recover__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (bool) ((arg1)->recover_);
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_n_dims__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_n_dims__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_n_dims__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_n_dims__set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->n_dims_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_n_dims__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_n_dims__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (int) ((arg1)->n_dims_);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_threshold__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_threshold__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_threshold__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->threshold_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_threshold__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_threshold__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (float) ((arg1)->threshold_);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_nnz__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::vector< int,std::allocator< int > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_nnz__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_nnz__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_nnz__set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_nnz__set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->nnz_ = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_nnz__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_nnz__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (std::vector< int,std::allocator< int > > *) & ((arg1)->nnz_);
  resultobj = swig::from(static_cast< std::vector<int,std::allocator< int > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_x__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_x__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_x__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_int_p_std__allocatorT_int_p_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_x__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_x__set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > * >(argp2);
  if (arg1) (arg1)->x_ = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_x__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_x__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > *) & ((arg1)->x_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_p_std__allocatorT_int_p_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_y__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::vector< float,std::allocator< float > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_y__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_y__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_y__set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_y__set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->y_ = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_y__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_y__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (std::vector< float,std::allocator< float > > *) & ((arg1)->y_);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_buf__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::vector< int,std::allocator< int > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_problem01_buf__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_buf__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_buf__set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_buf__set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->buf_ = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_buf__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_buf__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  result = (std::vector< int,std::allocator< int > > *) & ((arg1)->buf_);
  resultobj = swig::from(static_cast< std::vector<int,std::allocator< int > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem01__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  bool arg2 ;
  float arg3 = (float) .9 ;
  int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  nupic::algorithms::svm::svm_problem01 *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 3)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_problem01" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_problem01" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (swig_obj[2]) {
    {
      arg3 = (nupic::Real32) PyFloat_AsDouble(swig_obj[2]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem01 *)new nupic::algorithms::svm::svm_problem01(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem01__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  bool arg3 ;
  float arg4 = (float) .9 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  nupic::algorithms::svm::svm_problem01 *result = 0 ;
  
  if ((nobjs < 3) || (nobjs > 4)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_problem01" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_problem01" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_svm_problem01" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  if (swig_obj[3]) {
    {
      arg4 = (nupic::Real32) PyFloat_AsDouble(swig_obj[3]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem01 *)new nupic::algorithms::svm::svm_problem01(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem01__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::istream *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::svm::svm_problem01 *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_svm_problem01" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_svm_problem01" "', argument " "1"" of type '" "std::istream &""'"); 
  }
  arg1 = reinterpret_cast< std::istream * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem01 *)new nupic::algorithms::svm::svm_problem01(*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_problem01(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_svm_problem01",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if ((argc >= 2) && (argc <= 3)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 2) {
        {
          {
            int res = SWIG_AsVal_float(argv[2], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if ((argc >= 3) && (argc <= 4)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 3) {
        {
          {
            int res = SWIG_AsVal_float(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_3;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_svm_problem01__SWIG_2(self, argc, argv);
    case 2:
      return _wrap_new_svm_problem01__SWIG_0(self, argc, argv);
    case 3:
      return _wrap_new_svm_problem01__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_svm_problem01'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_problem01::svm_problem01(int,bool,float)\n"
    "    nupic::algorithms::svm::svm_problem01::svm_problem01(int,int,bool,float)\n"
    "    nupic::algorithms::svm::svm_problem01::svm_problem01(std::istream &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_svm_problem01(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_problem01" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem01 const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_n_dims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_n_dims" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem01 const *)arg1)->n_dims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_nnz(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i", NULL 
  };
  int result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_nnz",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_nnz" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_nnz" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem01 const *)arg1)->nnz(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_resize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_resize",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_resize" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_resize" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_set_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  nupic::algorithms::svm::svm_problem01::sample_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "s", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_problem01_set_sample",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_set_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_set_sample" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_int_t,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "svm_problem01_set_sample" "', argument " "3"" of type '" "nupic::algorithms::svm::svm_problem01::sample_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_set_sample" "', argument " "3"" of type '" "nupic::algorithms::svm::svm_problem01::sample_type const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::svm::svm_problem01::sample_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set_sample(arg2,(nupic::algorithms::svm::svm_problem01::sample_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_get_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i", NULL 
  };
  SwigValueWrapper< nupic::algorithms::svm::sample< float,int > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_get_sample",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_get_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_get_sample" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::svm::svm_problem01 const *)arg1)->get_sample(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::svm::svm_problem01::sample_type(static_cast< const nupic::algorithms::svm::svm_problem01::sample_type& >(result))), SWIGTYPE_p_nupic__algorithms__svm__sampleT_float_int_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_dense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  int arg2 ;
  float *arg3 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "sv", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_problem01_dense",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_dense" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_problem01_dense" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "svm_problem01_dense" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_problem01 const *)arg1)->dense(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_problem01 const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_problem01 const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_problem01_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_problem01_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_problem01_get_samples(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = (nupic::algorithms::svm::svm_problem01 *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "samplesIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_problem01_get_samples",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_problem01_get_samples" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_problem01_get_samples(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_problem01_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_decision_function(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_decision_function",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::decision_function *)new nupic::algorithms::svm::decision_function();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__decision_function, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_decision_function(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *arg1 = (nupic::algorithms::svm::decision_function *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__decision_function, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_decision_function" "', argument " "1"" of type '" "nupic::algorithms::svm::decision_function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::decision_function * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_decision_function_alpha_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *arg1 = (nupic::algorithms::svm::decision_function *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"decision_function_alpha_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__decision_function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "decision_function_alpha_set" "', argument " "1"" of type '" "nupic::algorithms::svm::decision_function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::decision_function * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "decision_function_alpha_set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->alpha = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_decision_function_alpha_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *arg1 = (nupic::algorithms::svm::decision_function *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__decision_function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "decision_function_alpha_get" "', argument " "1"" of type '" "nupic::algorithms::svm::decision_function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::decision_function * >(argp1);
  result = (float *) ((arg1)->alpha);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_decision_function_rho_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *arg1 = (nupic::algorithms::svm::decision_function *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"decision_function_rho_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__decision_function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "decision_function_rho_set" "', argument " "1"" of type '" "nupic::algorithms::svm::decision_function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::decision_function * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->rho = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_decision_function_rho_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::decision_function *arg1 = (nupic::algorithms::svm::decision_function *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__decision_function, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "decision_function_rho_get" "', argument " "1"" of type '" "nupic::algorithms::svm::decision_function *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::decision_function * >(argp1);
  result = (float) ((arg1)->rho);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *decision_function_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__decision_function, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_svm_model_n_dims__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_n_dims__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_dims__set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_model_n_dims__set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->n_dims_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_n_dims__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_dims__get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (int) ((arg1)->n_dims_);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_mem_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_sv_mem_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_mem_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_sv_mem_set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->sv_mem = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_mem_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_mem_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (float *) ((arg1)->sv_mem);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< float *,std::allocator< float * > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_sv_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_sv_set" "', argument " "2"" of type '" "std::vector< float *,std::allocator< float * > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_sv_set" "', argument " "2"" of type '" "std::vector< float *,std::allocator< float * > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< float *,std::allocator< float * > > * >(argp2);
  if (arg1) (arg1)->sv = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float *,std::allocator< float * > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< float *,std::allocator< float * > > *) & ((arg1)->sv);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_coef_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< float *,std::allocator< float * > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_sv_coef_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_coef_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_sv_coef_set" "', argument " "2"" of type '" "std::vector< float *,std::allocator< float * > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_sv_coef_set" "', argument " "2"" of type '" "std::vector< float *,std::allocator< float * > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< float *,std::allocator< float * > > * >(argp2);
  if (arg1) (arg1)->sv_coef = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_sv_coef_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float *,std::allocator< float * > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_sv_coef_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< float *,std::allocator< float * > > *) & ((arg1)->sv_coef);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_float_p_std__allocatorT_float_p_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_rho_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< float,std::allocator< float > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_rho_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_rho_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_rho_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_rho_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->rho = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_rho_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_rho_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< float,std::allocator< float > > *) & ((arg1)->rho);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_label_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< int,std::allocator< int > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_label_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_label_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_label_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_label_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->label = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_label_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_label_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< int,std::allocator< int > > *) & ((arg1)->label);
  resultobj = swig::from(static_cast< std::vector<int,std::allocator< int > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_n_sv_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< int,std::allocator< int > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_n_sv_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_sv_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_n_sv_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_n_sv_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->n_sv = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_n_sv_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_sv_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< int,std::allocator< int > > *) & ((arg1)->n_sv);
  resultobj = swig::from(static_cast< std::vector<int,std::allocator< int > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_probA_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< float,std::allocator< float > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_probA_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_probA_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_probA_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_probA_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->probA = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_probA_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_probA_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< float,std::allocator< float > > *) & ((arg1)->probA);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_probB_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< float,std::allocator< float > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_probB_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_probB_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_probB_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_probB_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->probB = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_probB_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_probB_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< float,std::allocator< float > > *) & ((arg1)->probB);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_w_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_model_w_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_w_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_w_set" "', argument " "2"" of type '" "std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_w_set" "', argument " "2"" of type '" "std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > * >(argp2);
  if (arg1) (arg1)->w = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_w_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_w_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  result = (std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > *) & ((arg1)->w);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_model const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_n_dims(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_dims" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_model const *)arg1)->n_dims();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_n_class(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_n_class" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_model const *)arg1)->n_class();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_svm_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_svm_model",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_model *)new nupic::algorithms::svm::svm_model();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_model, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_svm_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_model" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_model const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_model_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_model const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_model_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_model_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_model_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_get_support_vectors(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "svIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_model_get_support_vectors",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_get_support_vectors" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_model_get_support_vectors(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_get_support_vector_coefficients(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "svCoeffIn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_model_get_support_vector_coefficients",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_get_support_vector_coefficients" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_model_get_support_vector_coefficients(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_model_get_hyperplanes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_model *arg1 = (nupic::algorithms::svm::svm_model *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_model_get_hyperplanes" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_model *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_model * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_svm_svm_model_get_hyperplanes(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_model_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_model, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_QMatrix(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem *arg1 = 0 ;
  float arg2 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "prob",(char *) "g",(char *) "kernel",(char *) "cache_size", NULL 
  };
  nupic::algorithms::svm::QMatrix *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:new_QMatrix",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__algorithms__svm__svm_problem,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_QMatrix" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_QMatrix" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_QMatrix" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_QMatrix" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = static_cast< int >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::QMatrix *)new nupic::algorithms::svm::QMatrix((nupic::algorithms::svm::svm_problem const &)*arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__QMatrix, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_QMatrix(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QMatrix" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_get_Q(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "len", NULL 
  };
  float *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix_get_Q",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_get_Q" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix_get_Q" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix_get_Q" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float *)((nupic::algorithms::svm::QMatrix const *)arg1)->get_Q(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_get_QD(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_get_QD" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float *)((nupic::algorithms::svm::QMatrix const *)arg1)->get_QD();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_swap_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix_swap_index",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_swap_index" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix_swap_index" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix_swap_index" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap_index(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_dot(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  nupic::algorithms::svm::QMatrix::feature_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix_dot",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_dot" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix_dot" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix_dot" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::QMatrix::feature_type)((nupic::algorithms::svm::QMatrix const *)arg1)->dot(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_linear_kernel(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix_linear_kernel",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_linear_kernel" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix_linear_kernel" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix_linear_kernel" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::algorithms::svm::QMatrix const *)arg1)->linear_kernel(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix_rbf_kernel(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix *arg1 = (nupic::algorithms::svm::QMatrix *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix_rbf_kernel",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix_rbf_kernel" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix_rbf_kernel" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix_rbf_kernel" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::algorithms::svm::QMatrix const *)arg1)->rbf_kernel(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *QMatrix_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__QMatrix, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_QMatrix01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_problem01 *arg1 = 0 ;
  float arg2 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "prob",(char *) "g",(char *) "kernel",(char *) "cache_size", NULL 
  };
  nupic::algorithms::svm::QMatrix01 *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:new_QMatrix01",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__algorithms__svm__svm_problem01,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_QMatrix01" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_QMatrix01" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_problem01 const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_problem01 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_QMatrix01" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  ecode4 = SWIG_AsVal_int(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_QMatrix01" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = static_cast< int >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::QMatrix01 *)new nupic::algorithms::svm::QMatrix01((nupic::algorithms::svm::svm_problem01 const &)*arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_QMatrix01(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QMatrix01" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_get_Q(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "len", NULL 
  };
  float *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix01_get_Q",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_get_Q" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix01_get_Q" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix01_get_Q" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float *)((nupic::algorithms::svm::QMatrix01 const *)arg1)->get_Q(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_get_QD(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_get_QD" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float *)((nupic::algorithms::svm::QMatrix01 const *)arg1)->get_QD();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_swap_index(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix01_swap_index",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_swap_index" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix01_swap_index" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix01_swap_index" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap_index(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_dot(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  nupic::algorithms::svm::QMatrix01::feature_type result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix01_dot",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_dot" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix01_dot" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix01_dot" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::QMatrix01::feature_type)((nupic::algorithms::svm::QMatrix01 const *)arg1)->dot(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_linear_kernel(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix01_linear_kernel",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_linear_kernel" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix01_linear_kernel" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix01_linear_kernel" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::algorithms::svm::QMatrix01 const *)arg1)->linear_kernel(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_QMatrix01_rbf_kernel(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::QMatrix01 *arg1 = (nupic::algorithms::svm::QMatrix01 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:QMatrix01_rbf_kernel",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QMatrix01_rbf_kernel" "', argument " "1"" of type '" "nupic::algorithms::svm::QMatrix01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::QMatrix01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "QMatrix01_rbf_kernel" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "QMatrix01_rbf_kernel" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = static_cast< int >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)((nupic::algorithms::svm::QMatrix01 const *)arg1)->rbf_kernel(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *QMatrix01_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__QMatrix01, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_svm_parameter(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 ;
  bool arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  int arg6 ;
  int arg7 ;
  int val1 ;
  int ecode1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  char *  kwnames[] = {
    (char *) "k",(char *) "p",(char *) "g",(char *) "c",(char *) "e",(char *) "cs",(char *) "s", NULL 
  };
  nupic::algorithms::svm::svm_parameter *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOO:new_svm_parameter",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_parameter" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = static_cast< int >(val1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_parameter" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  ecode6 = SWIG_AsVal_int(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_svm_parameter" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = static_cast< int >(val6);
  ecode7 = SWIG_AsVal_int(obj6, &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "new_svm_parameter" "', argument " "7"" of type '" "int""'");
  } 
  arg7 = static_cast< int >(val7);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_parameter *)new nupic::algorithms::svm::svm_parameter(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_kernel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_kernel_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_kernel_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_parameter_kernel_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->kernel = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_kernel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_kernel_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (int) ((arg1)->kernel);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_probability_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_probability_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_probability_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_parameter_probability_set" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (arg1) (arg1)->probability = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_probability_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_probability_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (bool) ((arg1)->probability);
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_gamma_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_gamma_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_gamma_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->gamma = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_gamma_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_gamma_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (float) ((arg1)->gamma);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_C_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_C_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_C_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->C = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_C_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_C_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (float) ((arg1)->C);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_eps_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_eps_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_eps_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->eps = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_eps_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_eps_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (float) ((arg1)->eps);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_cache_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_cache_size_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_cache_size_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_parameter_cache_size_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->cache_size = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_cache_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_cache_size_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (int) ((arg1)->cache_size);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_shrinking_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_shrinking_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_shrinking_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_parameter_shrinking_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->shrinking = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_shrinking_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_shrinking_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (int) ((arg1)->shrinking);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_weight_label_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  std::vector< int,std::allocator< int > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_weight_label_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_weight_label_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_parameter_weight_label_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_parameter_weight_label_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->weight_label = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_weight_label_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< int,std::allocator< int > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_weight_label_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (std::vector< int,std::allocator< int > > *) & ((arg1)->weight_label);
  resultobj = swig::from(static_cast< std::vector<int,std::allocator< int > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_weight_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  std::vector< float,std::allocator< float > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"svm_parameter_weight_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_weight_set" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    std::vector<float,std::allocator< float > > *ptr = (std::vector<float,std::allocator< float > > *)0;
    res2 = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_parameter_weight_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_parameter_weight_set" "', argument " "2"" of type '" "std::vector< float,std::allocator< float > > const &""'"); 
    }
    arg2 = ptr;
  }
  if (arg1) (arg1)->weight = *arg2;
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_weight_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< float,std::allocator< float > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_weight_get" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  result = (std::vector< float,std::allocator< float > > *) & ((arg1)->weight);
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_parameter const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_parameter_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_parameter_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_parameter_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_parameter const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_parameter_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_parameter_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_parameter_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_parameter_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_parameter_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_svm_parameter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_parameter *arg1 = (nupic::algorithms::svm::svm_parameter *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_parameter" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_parameter *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_parameter * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_parameter_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_parameter, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_svm_std_traits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_std_traits *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_svm_std_traits",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_std_traits *)new nupic::algorithms::svm::svm_std_traits();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_std_traits, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_svm_std_traits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_std_traits *arg1 = (nupic::algorithms::svm::svm_std_traits *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_std_traits, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_std_traits" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_std_traits *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_std_traits * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_std_traits_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_std_traits, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_svm_01_traits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01_traits *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_svm_01_traits",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_01_traits *)new nupic::algorithms::svm::svm_01_traits();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_01_traits, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_svm_01_traits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01_traits *arg1 = (nupic::algorithms::svm::svm_01_traits *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01_traits, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_01_traits" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01_traits *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01_traits * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_01_traits_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_01_traits, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_svm_dense(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 = (int) 0 ;
  int arg2 = (int) 0 ;
  float arg3 = (float) .9 ;
  int arg4 = (int) 100 ;
  int arg5 = (int) 1 ;
  bool arg6 = (bool) false ;
  int arg7 = (int) -1 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  char *  kwnames[] = {
    (char *) "kernel",(char *) "n_dims",(char *) "threshold",(char *) "cache_size",(char *) "shrinking",(char *) "probability",(char *) "seed", NULL 
  };
  nupic::algorithms::svm::svm_dense *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOOOOO:new_svm_dense",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
  if (obj0) {
    ecode1 = SWIG_AsVal_int(obj0, &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_dense" "', argument " "1"" of type '" "int""'");
    } 
    arg1 = static_cast< int >(val1);
  }
  if (obj1) {
    ecode2 = SWIG_AsVal_int(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_dense" "', argument " "2"" of type '" "int""'");
    } 
    arg2 = static_cast< int >(val2);
  }
  if (obj2) {
    {
      arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
    }
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_int(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_svm_dense" "', argument " "4"" of type '" "int""'");
    } 
    arg4 = static_cast< int >(val4);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_int(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_svm_dense" "', argument " "5"" of type '" "int""'");
    } 
    arg5 = static_cast< int >(val5);
  }
  if (obj5) {
    ecode6 = SWIG_AsVal_bool(obj5, &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_svm_dense" "', argument " "6"" of type '" "bool""'");
    } 
    arg6 = static_cast< bool >(val6);
  }
  if (obj6) {
    ecode7 = SWIG_AsVal_int(obj6, &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "new_svm_dense" "', argument " "7"" of type '" "int""'");
    } 
    arg7 = static_cast< int >(val7);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_dense *)new nupic::algorithms::svm::svm_dense(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_dense, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_train(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  float arg2 ;
  float arg3 ;
  float arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:svm_dense_train",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_train" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->train(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_get_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::svm::svm_problem *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_get_problem" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem *) &(arg1)->get_problem();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_get_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::svm::svm_model *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_get_model" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_model *) &(arg1)->get_model();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_discard_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_discard_problem" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->discard_problem();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_cross_validation(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  int arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n_fold",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:svm_dense_cross_validation",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_cross_validation" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_dense_cross_validation" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)(arg1)->cross_validation(arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_dense const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_dense_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_dense_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_dense const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_dense_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_dense_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense___getstate__" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_svm_svm_dense___getstate__(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_loadFromString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inString", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_dense_loadFromString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_loadFromString" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_dense_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_dense_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_dense_loadFromString(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_add_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  float arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "y_val",(char *) "x_vector", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_dense_add_sample",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_add_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_dense_add_sample(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_predict(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x_vector", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_dense_predict",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_predict" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_dense_predict(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_predict_probability(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x_vector",(char *) "proba_vector", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_dense_predict_probability",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_predict_probability" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_dense_predict_probability(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_dense_save" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_dense_save" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_dense_save__SWIG_1(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_save(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"svm_dense_save",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__ostream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_svm_dense_save__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_svm_dense_save__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'svm_dense_save'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_dense::save(std::ostream &) const\n"
    "    nupic::algorithms::svm::svm_dense::save(std::string const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_svm_dense_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_dense_load" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_dense_load" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_dense_load__SWIG_1(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_load(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"svm_dense_load",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_svm_dense_load__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_svm_dense_load__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'svm_dense_load'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_dense::load(std::istream &)\n"
    "    nupic::algorithms::svm::svm_dense::load(std::string const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_svm_dense_cross_validate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  int arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n_fold",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:svm_dense_cross_validate",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_cross_validate" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_dense_cross_validate" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_dense_cross_validate(arg1,arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_dense_trainReleaseGIL(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  float arg2 ;
  float arg3 ;
  float arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:svm_dense_trainReleaseGIL",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_dense_trainReleaseGIL" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_dense_trainReleaseGIL(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_svm_dense(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_dense *arg1 = (nupic::algorithms::svm::svm_dense *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_dense, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_dense" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_dense *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_dense * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_dense_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_dense, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_svm_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  int arg1 = (int) 0 ;
  int arg2 = (int) 0 ;
  float arg3 = (float) .9 ;
  int arg4 = (int) 100 ;
  int arg5 = (int) 1 ;
  bool arg6 = (bool) false ;
  int arg7 = (int) -1 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  char *  kwnames[] = {
    (char *) "kernel",(char *) "n_dims",(char *) "threshold",(char *) "cache_size",(char *) "shrinking",(char *) "probability",(char *) "seed", NULL 
  };
  nupic::algorithms::svm::svm_01 *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOOOOO:new_svm_01",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
  if (obj0) {
    ecode1 = SWIG_AsVal_int(obj0, &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_svm_01" "', argument " "1"" of type '" "int""'");
    } 
    arg1 = static_cast< int >(val1);
  }
  if (obj1) {
    ecode2 = SWIG_AsVal_int(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_svm_01" "', argument " "2"" of type '" "int""'");
    } 
    arg2 = static_cast< int >(val2);
  }
  if (obj2) {
    {
      arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
    }
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_int(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_svm_01" "', argument " "4"" of type '" "int""'");
    } 
    arg4 = static_cast< int >(val4);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_int(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_svm_01" "', argument " "5"" of type '" "int""'");
    } 
    arg5 = static_cast< int >(val5);
  }
  if (obj5) {
    ecode6 = SWIG_AsVal_bool(obj5, &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_svm_01" "', argument " "6"" of type '" "bool""'");
    } 
    arg6 = static_cast< bool >(val6);
  }
  if (obj6) {
    ecode7 = SWIG_AsVal_int(obj6, &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "new_svm_01" "', argument " "7"" of type '" "int""'");
    } 
    arg7 = static_cast< int >(val7);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_01 *)new nupic::algorithms::svm::svm_01(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_01, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_train(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  float arg2 ;
  float arg3 ;
  float arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:svm_01_train",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_train" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->train(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_get_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::svm::svm_problem01 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_get_problem" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_problem01 *) &(arg1)->get_problem();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_problem01, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_get_model(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::svm::svm_model *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_get_model" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::svm::svm_model *) &(arg1)->get_model();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__svm__svm_model, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_discard_problem(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_discard_problem" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->discard_problem();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_cross_validation(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  int arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n_fold",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:svm_01_cross_validation",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_cross_validation" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_01_cross_validation" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)(arg1)->cross_validation(arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_persistent_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_persistent_size" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (int)((nupic::algorithms::svm::svm_01 const *)arg1)->persistent_size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_save__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_01_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_01_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::svm::svm_01 const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_load__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_01_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_01_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01___getstate__" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_svm_svm_01___getstate__(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_loadFromString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inString", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_01_loadFromString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_loadFromString" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_01_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_01_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_01_loadFromString(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_add_sample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  float arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "y_val",(char *) "x_vector", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_01_add_sample",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_add_sample" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_01_add_sample(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_predict(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x_vector", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:svm_01_predict",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_predict" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_01_predict(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_predict_probability(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x_vector",(char *) "proba_vector", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:svm_01_predict_probability",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_predict_probability" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_01_predict_probability(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_cross_validate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  int arg2 ;
  float arg3 ;
  float arg4 ;
  float arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n_fold",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:svm_01_cross_validate",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_cross_validate" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "svm_01_cross_validate" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)nupic_algorithms_svm_svm_01_cross_validate(arg1,arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_trainReleaseGIL(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  float arg2 ;
  float arg3 ;
  float arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "gamma",(char *) "C",(char *) "eps", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:svm_01_trainReleaseGIL",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_trainReleaseGIL" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_01_trainReleaseGIL(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_save__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_save" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_01_save" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_01_save" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_01_save__SWIG_1(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_save(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"svm_01_save",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__ostream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_svm_01_save__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_svm_01_save__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'svm_01_save'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_01::save(std::ostream &) const\n"
    "    nupic::algorithms::svm::svm_01::save(std::string const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_svm_01_load__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "svm_01_load" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "svm_01_load" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "svm_01_load" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_svm_svm_01_load__SWIG_1(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_svm_01_load(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"svm_01_load",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__svm__svm_01, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_svm_01_load__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_svm_01_load__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'svm_01_load'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::svm::svm_01::load(std::istream &)\n"
    "    nupic::algorithms::svm::svm_01::load(std::string const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_svm_01(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::svm::svm_01 *arg1 = (nupic::algorithms::svm::svm_01 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__svm__svm_01, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_svm_01" "', argument " "1"" of type '" "nupic::algorithms::svm::svm_01 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::svm::svm_01 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *svm_01_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__svm__svm_01, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_nrows__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_nrows__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_nrows__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_nrows__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->nrows_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_nrows__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_nrows__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->nrows_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_ncols__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_ncols__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_ncols__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_ncols__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->ncols_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_ncols__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_ncols__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->ncols_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_size__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f1_size__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_size__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f1_size__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f1_size_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_size__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_size__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f1_size_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_size__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f2_size__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_size__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f2_size__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f2_size_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_size__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_size__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f2_size_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_end_j__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f1_end_j__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_end_j__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f1_end_j__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f1_end_j_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_end_j__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_end_j__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f1_end_j_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_end_i__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f2_end_i__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_end_i__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f2_end_i__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f2_end_i_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_end_i__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_end_i__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f2_end_i_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_middle__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f1_middle__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_middle__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f1_middle__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f1_middle_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_middle__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_middle__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f1_middle_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_middle__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f2_middle__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_middle__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_f2_middle__set" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  if (arg1) (arg1)->f2_middle_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_middle__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SeparableConvolution2D< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_middle__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result =  ((arg1)->f2_middle_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f1__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_f1__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->f1_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result = (float *) ((arg1)->f1_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f2__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_f2__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->f2_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result = (float *) ((arg1)->f2_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_end__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f1_end__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_end__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_f1_end__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->f1_end_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f1_end__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f1_end__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result = (float *) ((arg1)->f1_end_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_end__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_f2_end__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_end__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_f2_end__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->f2_end_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_f2_end__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_f2_end__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result = (float *) ((arg1)->f2_end_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_buffer__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_buffer__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_buffer__set" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_buffer__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->buffer_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_buffer__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_buffer__get" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  result = (float *) ((arg1)->buffer_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_init__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  SeparableConvolution2D< float >::size_type arg2 ;
  SeparableConvolution2D< float >::size_type arg3 ;
  SeparableConvolution2D< float >::size_type arg4 ;
  SeparableConvolution2D< float >::size_type arg5 ;
  float *arg6 = (float *) 0 ;
  float *arg7 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  size_t val3 ;
  int ecode3 = 0 ;
  size_t val4 ;
  int ecode4 = 0 ;
  size_t val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  
  if ((nobjs < 7) || (nobjs > 7)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_init" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32SeparableConvolution2D_init" "', argument " "2"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg2 = static_cast< SeparableConvolution2D< float >::size_type >(val2);
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Float32SeparableConvolution2D_init" "', argument " "3"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg3 = static_cast< SeparableConvolution2D< float >::size_type >(val3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32SeparableConvolution2D_init" "', argument " "4"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg4 = static_cast< SeparableConvolution2D< float >::size_type >(val4);
  ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Float32SeparableConvolution2D_init" "', argument " "5"" of type '" "SeparableConvolution2D< float >::size_type""'");
  } 
  arg5 = static_cast< SeparableConvolution2D< float >::size_type >(val5);
  res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Float32SeparableConvolution2D_init" "', argument " "6"" of type '" "float *""'"); 
  }
  arg6 = reinterpret_cast< float * >(argp6);
  res7 = SWIG_ConvertPtr(swig_obj[6], &argp7,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Float32SeparableConvolution2D_init" "', argument " "7"" of type '" "float *""'"); 
  }
  arg7 = reinterpret_cast< float * >(argp7);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->init(arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Float32SeparableConvolution2D(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_Float32SeparableConvolution2D",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (SeparableConvolution2D< float > *)new SeparableConvolution2D< float >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SeparableConvolution2DT_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Float32SeparableConvolution2D(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Float32SeparableConvolution2D" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_compute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  if (swig_obj[3]) {
    ecode4 = SWIG_AsVal_bool(swig_obj[3], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "4"" of type '" "bool""'");
    } 
    arg4 = static_cast< bool >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->compute(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_init__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  PyObject *arg6 = (PyObject *) 0 ;
  PyObject *arg7 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 7) || (nobjs > 7)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_init" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(swig_obj[2]);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  {
    arg5 = (nupic::UInt32) PyLong_AsLong(swig_obj[4]);
  }
  arg6 = swig_obj[5];
  arg7 = swig_obj[6];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SeparableConvolution2D_Sl_float_Sg__init__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_init(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[8];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_init",0,7,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 7) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SeparableConvolution2DT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[5] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[6] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 7) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SeparableConvolution2DT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[6], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32SeparableConvolution2D_init__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Float32SeparableConvolution2D_init__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32SeparableConvolution2D_init'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    SeparableConvolution2D< float >::init(SeparableConvolution2D< float >::size_type,SeparableConvolution2D< float >::size_type,SeparableConvolution2D< float >::size_type,SeparableConvolution2D< float >::size_type,float *,float *)\n"
    "    SeparableConvolution2D< float >::init(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,PyObject *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_compute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  bool arg4 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "1"" of type '" "SeparableConvolution2D< float > *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  if (swig_obj[3]) {
    ecode4 = SWIG_AsVal_bool(swig_obj[3], &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32SeparableConvolution2D_compute" "', argument " "4"" of type '" "bool""'");
    } 
    arg4 = static_cast< bool >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SeparableConvolution2D_Sl_float_Sg__compute__SWIG_1(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_compute(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32SeparableConvolution2D_compute",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 3) && (argc <= 4)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SeparableConvolution2DT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 3) {
        {
          {
            int res = SWIG_AsVal_bool(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_1;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if ((argc >= 3) && (argc <= 4)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SeparableConvolution2DT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 3) {
        {
          {
            int res = SWIG_AsVal_bool(argv[3], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32SeparableConvolution2D_compute__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Float32SeparableConvolution2D_compute__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32SeparableConvolution2D_compute'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    SeparableConvolution2D< float >::compute(float *,float *,bool)\n"
    "    SeparableConvolution2D< float >::compute(PyObject *,PyObject *,bool)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Float32SeparableConvolution2D_getBuffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  SeparableConvolution2D< float > *arg1 = (SeparableConvolution2D< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "pyBuffer", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Float32SeparableConvolution2D_getBuffer",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SeparableConvolution2DT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32SeparableConvolution2D_getBuffer" "', argument " "1"" of type '" "SeparableConvolution2D< float > const *""'"); 
  }
  arg1 = reinterpret_cast< SeparableConvolution2D< float > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      SeparableConvolution2D_Sl_float_Sg__getBuffer((SeparableConvolution2D< float > const *)arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Float32SeparableConvolution2D_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_SeparableConvolution2DT_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Float32Rotation45_srow__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Rotation45_srow__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_srow__set" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Rotation45_srow__set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->srow_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_srow__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_srow__get" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  result = (int) ((arg1)->srow_);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_scol__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Rotation45_scol__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_scol__set" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Rotation45_scol__set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  if (arg1) (arg1)->scol_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_scol__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_scol__get" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  result = (int) ((arg1)->scol_);
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_offset__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Rotation45_offset__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_offset__set" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Rotation45_offset__set" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  if (arg1) (arg1)->offset_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_offset__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  size_t result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_offset__get" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  result =  ((arg1)->offset_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_round(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  float arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  float result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Float32Rotation45_round",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_round" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (float)(arg1)->round(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_rotate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  size_t arg4 ;
  size_t arg5 ;
  size_t arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  size_t val4 ;
  int ecode4 = 0 ;
  size_t val5 ;
  int ecode5 = 0 ;
  size_t val6 ;
  int ecode6 = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_rotate" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32Rotation45_rotate" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Float32Rotation45_rotate" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32Rotation45_rotate" "', argument " "4"" of type '" "size_t""'");
  } 
  arg4 = static_cast< size_t >(val4);
  ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Float32Rotation45_rotate" "', argument " "5"" of type '" "size_t""'");
  } 
  arg5 = static_cast< size_t >(val5);
  ecode6 = SWIG_AsVal_size_t(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Float32Rotation45_rotate" "', argument " "6"" of type '" "size_t""'");
  } 
  arg6 = static_cast< size_t >(val6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rotate(arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_unrotate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  size_t arg4 ;
  size_t arg5 ;
  size_t arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  size_t val4 ;
  int ecode4 = 0 ;
  size_t val5 ;
  int ecode5 = 0 ;
  size_t val6 ;
  int ecode6 = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_unrotate" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32Rotation45_unrotate" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Float32Rotation45_unrotate" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32Rotation45_unrotate" "', argument " "4"" of type '" "size_t""'");
  } 
  arg4 = static_cast< size_t >(val4);
  ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Float32Rotation45_unrotate" "', argument " "5"" of type '" "size_t""'");
  } 
  arg5 = static_cast< size_t >(val5);
  ecode6 = SWIG_AsVal_size_t(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Float32Rotation45_unrotate" "', argument " "6"" of type '" "size_t""'");
  } 
  arg6 = static_cast< size_t >(val6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->unrotate(arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_rotate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::UInt32 arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_rotate" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  {
    arg5 = (nupic::UInt32) PyLong_AsLong(swig_obj[4]);
  }
  {
    arg6 = (nupic::UInt32) PyLong_AsLong(swig_obj[5]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      Rotation45_Sl_float_Sg__rotate__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_rotate(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32Rotation45_rotate",0,6,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 6) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Rotation45T_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 6) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Rotation45T_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32Rotation45_rotate__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Float32Rotation45_rotate__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32Rotation45_rotate'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    Rotation45< float >::rotate(float *,float *,size_t,size_t,size_t)\n"
    "    Rotation45< float >::rotate(PyObject *,PyObject *,nupic::UInt32,nupic::UInt32,nupic::UInt32)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_unrotate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::UInt32 arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 6) || (nobjs > 6)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Rotation45_unrotate" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  {
    arg5 = (nupic::UInt32) PyLong_AsLong(swig_obj[4]);
  }
  {
    arg6 = (nupic::UInt32) PyLong_AsLong(swig_obj[5]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      Rotation45_Sl_float_Sg__unrotate__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Rotation45_unrotate(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[7];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32Rotation45_unrotate",0,6,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 6) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Rotation45T_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 6) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Rotation45T_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32Rotation45_unrotate__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Float32Rotation45_unrotate__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32Rotation45_unrotate'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    Rotation45< float >::unrotate(float *,float *,size_t,size_t,size_t)\n"
    "    Rotation45< float >::unrotate(PyObject *,PyObject *,nupic::UInt32,nupic::UInt32,nupic::UInt32)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_Float32Rotation45(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_Float32Rotation45",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (Rotation45< float > *)new Rotation45< float >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Rotation45T_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Float32Rotation45(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Rotation45< float > *arg1 = (Rotation45< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Rotation45T_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Float32Rotation45" "', argument " "1"" of type '" "Rotation45< float > *""'"); 
  }
  arg1 = reinterpret_cast< Rotation45< float > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Float32Rotation45_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_Rotation45T_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Float32Erosion_nrows__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  Erosion< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Erosion_nrows__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_nrows__set" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Erosion_nrows__set" "', argument " "2"" of type '" "Erosion< float >::size_type""'");
  } 
  arg2 = static_cast< Erosion< float >::size_type >(val2);
  if (arg1) (arg1)->nrows_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_nrows__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  Erosion< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_nrows__get" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  result =  ((arg1)->nrows_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_ncols__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  Erosion< float >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Erosion_ncols__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_ncols__set" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Erosion_ncols__set" "', argument " "2"" of type '" "Erosion< float >::size_type""'");
  } 
  arg2 = static_cast< Erosion< float >::size_type >(val2);
  if (arg1) (arg1)->ncols_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_ncols__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  Erosion< float >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_ncols__get" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  result =  ((arg1)->ncols_);
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_buffer__set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Float32Erosion_buffer__set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_buffer__set" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32Erosion_buffer__set" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  if (arg1) (arg1)->buffer_ = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_buffer__get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  float *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_buffer__get" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  result = (float *) ((arg1)->buffer_);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_init__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  Erosion< float >::size_type arg2 ;
  Erosion< float >::size_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  size_t val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_init" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Float32Erosion_init" "', argument " "2"" of type '" "Erosion< float >::size_type""'");
  } 
  arg2 = static_cast< Erosion< float >::size_type >(val2);
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Float32Erosion_init" "', argument " "3"" of type '" "Erosion< float >::size_type""'");
  } 
  arg3 = static_cast< Erosion< float >::size_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->init(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Float32Erosion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_Float32Erosion",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (Erosion< float > *)new Erosion< float >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ErosionT_float_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Float32Erosion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Float32Erosion" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_compute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  Erosion< float >::size_type arg4 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  size_t val4 ;
  int ecode4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_compute" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Float32Erosion_compute" "', argument " "2"" of type '" "float *""'"); 
  }
  arg2 = reinterpret_cast< float * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Float32Erosion_compute" "', argument " "3"" of type '" "float *""'"); 
  }
  arg3 = reinterpret_cast< float * >(argp3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Float32Erosion_compute" "', argument " "4"" of type '" "Erosion< float >::size_type""'");
  } 
  arg4 = static_cast< Erosion< float >::size_type >(val4);
  if (swig_obj[4]) {
    ecode5 = SWIG_AsVal_bool(swig_obj[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Float32Erosion_compute" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->compute(arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_init__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_init" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(swig_obj[2]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      Erosion_Sl_float_Sg__init__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_init(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32Erosion_init",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ErosionT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ErosionT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32Erosion_init__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Float32Erosion_init__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32Erosion_init'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    Erosion< float >::init(Erosion< float >::size_type,Erosion< float >::size_type)\n"
    "    Erosion< float >::init(nupic::UInt32,nupic::UInt32)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_compute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  nupic::UInt32 arg4 ;
  bool arg5 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_compute" "', argument " "1"" of type '" "Erosion< float > *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  if (swig_obj[4]) {
    ecode5 = SWIG_AsVal_bool(swig_obj[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Float32Erosion_compute" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      Erosion_Sl_float_Sg__compute__SWIG_1(arg1,arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_compute(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[6];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Float32Erosion_compute",0,5,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 4) && (argc <= 5)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ErosionT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 4) {
        {
          {
            int res = SWIG_AsVal_bool(argv[4], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_1;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if ((argc >= 4) && (argc <= 5)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ErosionT_float_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 4) {
        {
          {
            int res = SWIG_AsVal_bool(argv[4], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Float32Erosion_compute__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Float32Erosion_compute__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Float32Erosion_compute'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    Erosion< float >::compute(float *,float *,Erosion< float >::size_type,bool)\n"
    "    Erosion< float >::compute(PyObject *,PyObject *,nupic::UInt32,bool)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Float32Erosion_getBuffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  Erosion< float > *arg1 = (Erosion< float > *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "pyBuffer", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Float32Erosion_getBuffer",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ErosionT_float_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Float32Erosion_getBuffer" "', argument " "1"" of type '" "Erosion< float > const *""'"); 
  }
  arg1 = reinterpret_cast< Erosion< float > * >(argp1);
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      Erosion_Sl_float_Sg__getBuffer((Erosion< float > const *)arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Float32Erosion_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_ErosionT_float_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_computeAlpha__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  size_t arg1 ;
  size_t arg2 ;
  size_t arg3 ;
  size_t arg4 ;
  size_t arg5 ;
  size_t arg6 ;
  size_t arg7 ;
  size_t arg8 ;
  size_t arg9 ;
  float arg10 ;
  float *arg11 = (float *) 0 ;
  float *arg12 = (float *) 0 ;
  float *arg13 = (float *) 0 ;
  float *arg14 = (float *) 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  size_t val3 ;
  int ecode3 = 0 ;
  size_t val4 ;
  int ecode4 = 0 ;
  size_t val5 ;
  int ecode5 = 0 ;
  size_t val6 ;
  int ecode6 = 0 ;
  size_t val7 ;
  int ecode7 = 0 ;
  size_t val8 ;
  int ecode8 = 0 ;
  size_t val9 ;
  int ecode9 = 0 ;
  void *argp11 = 0 ;
  int res11 = 0 ;
  void *argp12 = 0 ;
  int res12 = 0 ;
  void *argp13 = 0 ;
  int res13 = 0 ;
  void *argp14 = 0 ;
  int res14 = 0 ;
  
  if ((nobjs < 14) || (nobjs > 14)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "computeAlpha" "', argument " "1"" of type '" "size_t""'");
  } 
  arg1 = static_cast< size_t >(val1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "computeAlpha" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "computeAlpha" "', argument " "3"" of type '" "size_t""'");
  } 
  arg3 = static_cast< size_t >(val3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "computeAlpha" "', argument " "4"" of type '" "size_t""'");
  } 
  arg4 = static_cast< size_t >(val4);
  ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "computeAlpha" "', argument " "5"" of type '" "size_t""'");
  } 
  arg5 = static_cast< size_t >(val5);
  ecode6 = SWIG_AsVal_size_t(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "computeAlpha" "', argument " "6"" of type '" "size_t""'");
  } 
  arg6 = static_cast< size_t >(val6);
  ecode7 = SWIG_AsVal_size_t(swig_obj[6], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "computeAlpha" "', argument " "7"" of type '" "size_t""'");
  } 
  arg7 = static_cast< size_t >(val7);
  ecode8 = SWIG_AsVal_size_t(swig_obj[7], &val8);
  if (!SWIG_IsOK(ecode8)) {
    SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "computeAlpha" "', argument " "8"" of type '" "size_t""'");
  } 
  arg8 = static_cast< size_t >(val8);
  ecode9 = SWIG_AsVal_size_t(swig_obj[8], &val9);
  if (!SWIG_IsOK(ecode9)) {
    SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "computeAlpha" "', argument " "9"" of type '" "size_t""'");
  } 
  arg9 = static_cast< size_t >(val9);
  {
    arg10 = (nupic::Real32) PyFloat_AsDouble(swig_obj[9]);
  }
  res11 = SWIG_ConvertPtr(swig_obj[10], &argp11,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res11)) {
    SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "computeAlpha" "', argument " "11"" of type '" "float *""'"); 
  }
  arg11 = reinterpret_cast< float * >(argp11);
  res12 = SWIG_ConvertPtr(swig_obj[11], &argp12,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res12)) {
    SWIG_exception_fail(SWIG_ArgError(res12), "in method '" "computeAlpha" "', argument " "12"" of type '" "float *""'"); 
  }
  arg12 = reinterpret_cast< float * >(argp12);
  res13 = SWIG_ConvertPtr(swig_obj[12], &argp13,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res13)) {
    SWIG_exception_fail(SWIG_ArgError(res13), "in method '" "computeAlpha" "', argument " "13"" of type '" "float *""'"); 
  }
  arg13 = reinterpret_cast< float * >(argp13);
  res14 = SWIG_ConvertPtr(swig_obj[13], &argp14,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res14)) {
    SWIG_exception_fail(SWIG_ArgError(res14), "in method '" "computeAlpha" "', argument " "14"" of type '" "float *""'"); 
  }
  arg14 = reinterpret_cast< float * >(argp14);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      computeAlpha(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_computeAlpha__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::UInt32 arg5 ;
  nupic::UInt32 arg6 ;
  nupic::UInt32 arg7 ;
  nupic::UInt32 arg8 ;
  nupic::UInt32 arg9 ;
  float arg10 ;
  PyObject *arg11 = (PyObject *) 0 ;
  PyObject *arg12 = (PyObject *) 0 ;
  PyObject *arg13 = (PyObject *) 0 ;
  PyObject *arg14 = (PyObject *) 0 ;
  
  if ((nobjs < 14) || (nobjs > 14)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(swig_obj[2]);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  {
    arg5 = (nupic::UInt32) PyLong_AsLong(swig_obj[4]);
  }
  {
    arg6 = (nupic::UInt32) PyLong_AsLong(swig_obj[5]);
  }
  {
    arg7 = (nupic::UInt32) PyLong_AsLong(swig_obj[6]);
  }
  {
    arg8 = (nupic::UInt32) PyLong_AsLong(swig_obj[7]);
  }
  {
    arg9 = (nupic::UInt32) PyLong_AsLong(swig_obj[8]);
  }
  {
    arg10 = (nupic::Real32) PyFloat_AsDouble(swig_obj[9]);
  }
  arg11 = swig_obj[10];
  arg12 = swig_obj[11];
  arg13 = swig_obj[12];
  arg14 = swig_obj[13];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      computeAlpha(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_computeAlpha(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[15];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"computeAlpha",0,14,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 14) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[6], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[7], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[8], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[9], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[10] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[11] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[12] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[13] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 14) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[5], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[6], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[7], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[8], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[9], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[10], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[11], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[12], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[13], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_computeAlpha__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_computeAlpha__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'computeAlpha'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    computeAlpha(size_t,size_t,size_t,size_t,size_t,size_t,size_t,size_t,size_t,float,float *,float *,float *,float *)\n"
    "    computeAlpha(nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,nupic::UInt32,float,PyObject *,PyObject *,PyObject *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  PyObject **arg2 = (PyObject **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  arg2 = &swig_obj[0];
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_iterator" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_nupic_Byte_Sg__iterator(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___nonzero__" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_nupic_Byte_Sg____nonzero__((std::vector< char > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___bool__" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_nupic_Byte_Sg____bool__((std::vector< char > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___len__" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_nupic_Byte_Sg____len__((std::vector< char > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_pop" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< char >::value_type)std_vector_Sl_nupic_Byte_Sg__pop(arg1);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_char(static_cast< char >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  std::vector< char >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  std::vector< char,std::allocator< char > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Byte_Vector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___getslice__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___getslice__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector___getslice__" "', argument " "3"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< char >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< char,std::allocator< char > > *)std_vector_Sl_nupic_Byte_Sg____getslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  std::vector< char >::difference_type arg3 ;
  std::vector< char,std::allocator< char > > const &arg4_defvalue = std::vector< char,std::allocator< char > >() ;
  std::vector< char,std::allocator< char > > *arg4 = (std::vector< char,std::allocator< char > > *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Byte_Vector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___setslice__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___setslice__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector___setslice__" "', argument " "3"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< char >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<char,std::allocator< char > > *ptr = (std::vector<char,std::allocator< char > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Byte_Vector___setslice__" "', argument " "4"" of type '" "std::vector< char,std::allocator< char > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Byte_Vector___setslice__" "', argument " "4"" of type '" "std::vector< char,std::allocator< char > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____setslice__(arg1,arg2,arg3,(std::vector< char,std::allocator< char > > const &)*arg4);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  std::vector< char >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Byte_Vector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___delslice__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___delslice__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector___delslice__" "', argument " "3"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< char >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____delslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___delitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___delitem__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____delitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< char,std::allocator< char > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___getitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< char,std::allocator< char > > *)std_vector_Sl_nupic_Byte_Sg____getitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< char,std::allocator< char > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___setitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<char,std::allocator< char > > *ptr = (std::vector<char,std::allocator< char > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Byte_Vector___setitem__" "', argument " "3"" of type '" "std::vector< char,std::allocator< char > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Byte_Vector___setitem__" "', argument " "3"" of type '" "std::vector< char,std::allocator< char > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< char,std::allocator< char > > const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___setitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___delitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____delitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector___delitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::__delitem__(std::vector< char >::difference_type)\n"
    "    std::vector< nupic::Byte >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< char >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___getitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___getitem__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< char >::value_type *) &std_vector_Sl_nupic_Byte_Sg____getitem____SWIG_1((std::vector< char > const *)arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_char(static_cast< char >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector___getitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::__getitem__(PySliceObject *)\n"
    "    std::vector< nupic::Byte >::__getitem__(std::vector< char >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::difference_type arg2 ;
  std::vector< char >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< char >::value_type temp3 ;
  char val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector___setitem__" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector___setitem__" "', argument " "2"" of type '" "std::vector< char >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< char >::difference_type >(val2);
  ecode3 = SWIG_AsVal_char(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector___setitem__" "', argument " "3"" of type '" "std::vector< char >::value_type""'");
  } 
  temp3 = static_cast< std::vector< char >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_nupic_Byte_Sg____setitem____SWIG_2(arg1,arg2,(char const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector___setitem__",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_char(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_Byte_Vector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::__setitem__(PySliceObject *,std::vector< char,std::allocator< char > > const &)\n"
    "    std::vector< nupic::Byte >::__setitem__(PySliceObject *)\n"
    "    std::vector< nupic::Byte >::__setitem__(std::vector< char >::difference_type,std::vector< char >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< char >::value_type temp2 ;
  char val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Byte_Vector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_append" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_char(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_append" "', argument " "2"" of type '" "std::vector< char >::value_type""'");
  } 
  temp2 = static_cast< std::vector< char >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_nupic_Byte_Sg__append(arg1,(char const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Byte_Vector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< nupic::Byte > *)new std::vector< nupic::Byte >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Byte_Vector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< nupic::Byte > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<char,std::allocator< char > > *ptr = (std::vector<char,std::allocator< char > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Byte_Vector" "', argument " "1"" of type '" "std::vector< nupic::Byte > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Byte_Vector" "', argument " "1"" of type '" "std::vector< nupic::Byte > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< nupic::Byte > *)new std::vector< nupic::Byte >((std::vector< nupic::Byte > const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_empty" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< nupic::Byte > const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_size" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< nupic::Byte > const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_clear" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< nupic::Byte > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Byte_Vector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_swap" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Byte_Vector_swap" "', argument " "2"" of type '" "std::vector< nupic::Byte > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Byte_Vector_swap" "', argument " "2"" of type '" "std::vector< nupic::Byte > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Byte > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< char > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_get_allocator" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< nupic::Byte > const *)arg1)->get_allocator();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new std::vector< char >::allocator_type(static_cast< const std::vector< char >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_char_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< char >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_begin" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< char >::iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_end" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< char >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_rbegin" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rbegin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< char >::reverse_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_rend" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rend();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Byte_Vector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< char >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< nupic::Byte > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Byte_Vector" "', argument " "1"" of type '" "std::vector< char >::size_type""'");
  } 
  arg1 = static_cast< std::vector< char >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< nupic::Byte > *)new std::vector< nupic::Byte >(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_pop_back" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_resize" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_resize" "', argument " "2"" of type '" "std::vector< char >::size_type""'");
  } 
  arg2 = static_cast< std::vector< char >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  SwigValueWrapper< std::vector< char >::iterator > arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  SwigValueWrapper< std::vector< char >::iterator > result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_erase" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< char >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_nupic_Byte_Sg__erase__SWIG_0(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  SwigValueWrapper< std::vector< char >::iterator > arg2 ;
  SwigValueWrapper< std::vector< char >::iterator > arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  SwigValueWrapper< std::vector< char >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_erase" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< char >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res3) || !iter3) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "3"" of type '" "std::vector< char >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< char >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_erase" "', argument " "3"" of type '" "std::vector< char >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_nupic_Byte_Sg__erase__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector_erase",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::erase(std::vector< char >::iterator)\n"
    "    std::vector< nupic::Byte >::erase(std::vector< char >::iterator,std::vector< char >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_Byte_Vector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< char >::size_type arg1 ;
  std::vector< char >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< char >::value_type temp2 ;
  char val2 ;
  int ecode2 = 0 ;
  std::vector< nupic::Byte > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Byte_Vector" "', argument " "1"" of type '" "std::vector< char >::size_type""'");
  } 
  arg1 = static_cast< std::vector< char >::size_type >(val1);
  ecode2 = SWIG_AsVal_char(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Byte_Vector" "', argument " "2"" of type '" "std::vector< char >::value_type""'");
  } 
  temp2 = static_cast< std::vector< char >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< nupic::Byte > *)new std::vector< nupic::Byte >(arg1,(std::vector< char >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Byte_Vector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_Byte_Vector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_char(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_Byte_Vector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_Byte_Vector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_Byte_Vector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_Byte_Vector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Byte_Vector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::vector()\n"
    "    std::vector< nupic::Byte >::vector(std::vector< nupic::Byte > const &)\n"
    "    std::vector< nupic::Byte >::vector(std::vector< char >::size_type)\n"
    "    std::vector< nupic::Byte >::vector(std::vector< char >::size_type,std::vector< char >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< char >::value_type temp2 ;
  char val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Byte_Vector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_push_back" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_char(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_push_back" "', argument " "2"" of type '" "std::vector< char >::value_type""'");
  } 
  temp2 = static_cast< std::vector< char >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< char >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_front" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< char >::value_type *) &((std::vector< nupic::Byte > const *)arg1)->front();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_char(static_cast< char >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_back" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< char >::value_type *) &((std::vector< nupic::Byte > const *)arg1)->back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_char(static_cast< char >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::size_type arg2 ;
  std::vector< char >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< char >::value_type temp3 ;
  char val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Byte_Vector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_assign" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_assign" "', argument " "2"" of type '" "std::vector< char >::size_type""'");
  } 
  arg2 = static_cast< std::vector< char >::size_type >(val2);
  ecode3 = SWIG_AsVal_char(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector_assign" "', argument " "3"" of type '" "std::vector< char >::value_type""'");
  } 
  temp3 = static_cast< std::vector< char >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< char >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::size_type arg2 ;
  std::vector< char >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< char >::value_type temp3 ;
  char val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_resize" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_resize" "', argument " "2"" of type '" "std::vector< char >::size_type""'");
  } 
  arg2 = static_cast< std::vector< char >::size_type >(val2);
  ecode3 = SWIG_AsVal_char(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector_resize" "', argument " "3"" of type '" "std::vector< char >::value_type""'");
  } 
  temp3 = static_cast< std::vector< char >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< char >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector_resize",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_char(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::resize(std::vector< char >::size_type)\n"
    "    std::vector< nupic::Byte >::resize(std::vector< char >::size_type,std::vector< char >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  SwigValueWrapper< std::vector< char >::iterator > arg2 ;
  std::vector< char >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< char >::value_type temp3 ;
  char val3 ;
  int ecode3 = 0 ;
  SwigValueWrapper< std::vector< char >::iterator > result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_insert" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_insert" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< char >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_insert" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_char(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector_insert" "', argument " "3"" of type '" "std::vector< char >::value_type""'");
  } 
  temp3 = static_cast< std::vector< char >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_nupic_Byte_Sg__insert__SWIG_0(arg1,arg2,(char const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< char >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  SwigValueWrapper< std::vector< char >::iterator > arg2 ;
  std::vector< char >::size_type arg3 ;
  std::vector< char >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< char >::value_type temp4 ;
  char val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_insert" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_insert" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< char >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Byte_Vector_insert" "', argument " "2"" of type '" "std::vector< char >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Byte_Vector_insert" "', argument " "3"" of type '" "std::vector< char >::size_type""'");
  } 
  arg3 = static_cast< std::vector< char >::size_type >(val3);
  ecode4 = SWIG_AsVal_char(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Byte_Vector_insert" "', argument " "4"" of type '" "std::vector< char >::value_type""'");
  } 
  temp4 = static_cast< std::vector< char >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_nupic_Byte_Sg__insert__SWIG_1(arg1,arg2,arg3,(char const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Byte_Vector_insert",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_char(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<char,std::allocator< char > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< char >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_char(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Byte_Vector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Byte_Vector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Byte_Vector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< nupic::Byte >::insert(std::vector< char >::iterator,std::vector< char >::value_type const &)\n"
    "    std::vector< nupic::Byte >::insert(std::vector< char >::iterator,std::vector< char >::size_type,std::vector< char >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  std::vector< char >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Byte_Vector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_reserve" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Byte_Vector_reserve" "', argument " "2"" of type '" "std::vector< char >::size_type""'");
  } 
  arg2 = static_cast< std::vector< char >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reserve(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Byte_Vector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< char >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Byte_Vector_capacity" "', argument " "1"" of type '" "std::vector< nupic::Byte > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< nupic::Byte > const *)arg1)->capacity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Byte_Vector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< nupic::Byte > *arg1 = (std::vector< nupic::Byte > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Byte_Vector" "', argument " "1"" of type '" "std::vector< nupic::Byte > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Byte > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Byte_Vector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_char_std__allocatorT_char_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_ByteVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  size_t arg1 = (size_t) 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "n", NULL 
  };
  nupic::ByteVector *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:new_ByteVector",kwnames,&obj0)) SWIG_fail;
  if (obj0) {
    ecode1 = SWIG_AsVal_size_t(obj0, &val1);
    if (!SWIG_IsOK(ecode1)) {
      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ByteVector" "', argument " "1"" of type '" "size_t""'");
    } 
    arg1 = static_cast< size_t >(val1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::ByteVector *)new nupic::ByteVector(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__ByteVector, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ByteVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::ByteVector *arg1 = (nupic::ByteVector *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__ByteVector, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ByteVector" "', argument " "1"" of type '" "nupic::ByteVector *""'"); 
  }
  arg1 = reinterpret_cast< nupic::ByteVector * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ByteVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__ByteVector, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Size_T_Vector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  PyObject **arg2 = (PyObject **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  arg2 = &swig_obj[0];
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_iterator" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)std_vector_Sl_size_t_Sg__iterator(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___nonzero__" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_size_t_Sg____nonzero__((std::vector< size_t > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___bool__" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)std_vector_Sl_size_t_Sg____bool__((std::vector< size_t > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___len__" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_size_t_Sg____len__((std::vector< size_t > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_pop" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = std_vector_Sl_size_t_Sg__pop(arg1);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  std::vector< size_t >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  std::vector< size_t,std::allocator< size_t > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Size_T_Vector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___getslice__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___getslice__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector___getslice__" "', argument " "3"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< size_t >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< size_t,std::allocator< size_t > > *)std_vector_Sl_size_t_Sg____getslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  std::vector< size_t >::difference_type arg3 ;
  std::vector< size_t,std::allocator< size_t > > const &arg4_defvalue = std::vector< size_t,std::allocator< size_t > >() ;
  std::vector< size_t,std::allocator< size_t > > *arg4 = (std::vector< size_t,std::allocator< size_t > > *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Size_T_Vector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___setslice__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___setslice__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector___setslice__" "', argument " "3"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< size_t >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<size_t,std::allocator< size_t > > *ptr = (std::vector<size_t,std::allocator< size_t > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Size_T_Vector___setslice__" "', argument " "4"" of type '" "std::vector< size_t,std::allocator< size_t > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Size_T_Vector___setslice__" "', argument " "4"" of type '" "std::vector< size_t,std::allocator< size_t > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____setslice__(arg1,arg2,arg3,(std::vector< size_t,std::allocator< size_t > > const &)*arg4);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  std::vector< size_t >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Size_T_Vector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___delslice__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___delslice__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector___delslice__" "', argument " "3"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg3 = static_cast< std::vector< size_t >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____delslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___delitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___delitem__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____delitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< size_t,std::allocator< size_t > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___getitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< size_t,std::allocator< size_t > > *)std_vector_Sl_size_t_Sg____getitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< size_t,std::allocator< size_t > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___setitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<size_t,std::allocator< size_t > > *ptr = (std::vector<size_t,std::allocator< size_t > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Size_T_Vector___setitem__" "', argument " "3"" of type '" "std::vector< size_t,std::allocator< size_t > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Size_T_Vector___setitem__" "', argument " "3"" of type '" "std::vector< size_t,std::allocator< size_t > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< size_t,std::allocator< size_t > > const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___setitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____setitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___delitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____delitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector___delitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::__delitem__(std::vector< size_t >::difference_type)\n"
    "    std::vector< size_t >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< size_t >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___getitem__" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___getitem__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< size_t >::value_type *) &std_vector_Sl_size_t_Sg____getitem____SWIG_1((std::vector< size_t > const *)arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector___getitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::__getitem__(PySliceObject *)\n"
    "    std::vector< size_t >::__getitem__(std::vector< size_t >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::difference_type arg2 ;
  std::vector< size_t >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  std::vector< size_t >::value_type temp3 ;
  size_t val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector___setitem__" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector___setitem__" "', argument " "2"" of type '" "std::vector< size_t >::difference_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::difference_type >(val2);
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector___setitem__" "', argument " "3"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp3 = static_cast< std::vector< size_t >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        std_vector_Sl_size_t_Sg____setitem____SWIG_2(arg1,arg2,(size_t const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector___setitem__",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_Size_T_Vector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::__setitem__(PySliceObject *,std::vector< size_t,std::allocator< size_t > > const &)\n"
    "    std::vector< size_t >::__setitem__(PySliceObject *)\n"
    "    std::vector< size_t >::__setitem__(std::vector< size_t >::difference_type,std::vector< size_t >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< size_t >::value_type temp2 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Size_T_Vector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_append" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_append" "', argument " "2"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp2 = static_cast< std::vector< size_t >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_size_t_Sg__append(arg1,(size_t const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Size_T_Vector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  std::vector< size_t > *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t > *)new std::vector< size_t >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Size_T_Vector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  std::vector< size_t > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<size_t,std::allocator< size_t > > *ptr = (std::vector<size_t,std::allocator< size_t > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Size_T_Vector" "', argument " "1"" of type '" "std::vector< size_t > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Size_T_Vector" "', argument " "1"" of type '" "std::vector< size_t > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t > *)new std::vector< size_t >((std::vector< size_t > const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_empty" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((std::vector< size_t > const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_size" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< size_t > const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_clear" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Size_T_Vector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_swap" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Size_T_Vector_swap" "', argument " "2"" of type '" "std::vector< size_t > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Size_T_Vector_swap" "', argument " "2"" of type '" "std::vector< size_t > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< size_t > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< size_t > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_get_allocator" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< size_t > const *)arg1)->get_allocator();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new std::vector< size_t >::allocator_type(static_cast< const std::vector< size_t >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_size_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_begin" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_end" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_rbegin" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rbegin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_rend" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rend();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Size_T_Vector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< size_t > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Size_T_Vector" "', argument " "1"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg1 = static_cast< std::vector< size_t >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t > *)new std::vector< size_t >(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_pop_back" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_resize" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_resize" "', argument " "2"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< size_t >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_erase" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< size_t >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_size_t_Sg__erase__SWIG_0(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::iterator arg2 ;
  std::vector< size_t >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  std::vector< size_t >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_erase" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< size_t >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res3) || !iter3) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "3"" of type '" "std::vector< size_t >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< size_t >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_erase" "', argument " "3"" of type '" "std::vector< size_t >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_size_t_Sg__erase__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector_erase",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::erase(std::vector< size_t >::iterator)\n"
    "    std::vector< size_t >::erase(std::vector< size_t >::iterator,std::vector< size_t >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_Size_T_Vector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t >::size_type arg1 ;
  std::vector< size_t >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  std::vector< size_t >::value_type temp2 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< size_t > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Size_T_Vector" "', argument " "1"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg1 = static_cast< std::vector< size_t >::size_type >(val1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Size_T_Vector" "', argument " "2"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp2 = static_cast< std::vector< size_t >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t > *)new std::vector< size_t >(arg1,(std::vector< size_t >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Size_T_Vector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_Size_T_Vector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_Size_T_Vector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_Size_T_Vector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_Size_T_Vector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_Size_T_Vector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Size_T_Vector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::vector()\n"
    "    std::vector< size_t >::vector(std::vector< size_t > const &)\n"
    "    std::vector< size_t >::vector(std::vector< size_t >::size_type)\n"
    "    std::vector< size_t >::vector(std::vector< size_t >::size_type,std::vector< size_t >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< size_t >::value_type temp2 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Size_T_Vector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_push_back" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_push_back" "', argument " "2"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp2 = static_cast< std::vector< size_t >::value_type >(val2);
  arg2 = &temp2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((std::vector< size_t >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_front" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t >::value_type *) &((std::vector< size_t > const *)arg1)->front();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_back" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (std::vector< size_t >::value_type *) &((std::vector< size_t > const *)arg1)->back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::size_type arg2 ;
  std::vector< size_t >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< size_t >::value_type temp3 ;
  size_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Size_T_Vector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_assign" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_assign" "', argument " "2"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::size_type >(val2);
  ecode3 = SWIG_AsVal_size_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector_assign" "', argument " "3"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp3 = static_cast< std::vector< size_t >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(std::vector< size_t >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::size_type arg2 ;
  std::vector< size_t >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  std::vector< size_t >::value_type temp3 ;
  size_t val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_resize" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_resize" "', argument " "2"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::size_type >(val2);
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector_resize" "', argument " "3"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp3 = static_cast< std::vector< size_t >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(std::vector< size_t >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector_resize",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::resize(std::vector< size_t >::size_type)\n"
    "    std::vector< size_t >::resize(std::vector< size_t >::size_type,std::vector< size_t >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::iterator arg2 ;
  std::vector< size_t >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  std::vector< size_t >::value_type temp3 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< size_t >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_insert" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_insert" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< size_t >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_insert" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector_insert" "', argument " "3"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp3 = static_cast< std::vector< size_t >::value_type >(val3);
  arg3 = &temp3;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = std_vector_Sl_size_t_Sg__insert__SWIG_0(arg1,arg2,(size_t const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< size_t >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::iterator arg2 ;
  std::vector< size_t >::size_type arg3 ;
  std::vector< size_t >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  std::vector< size_t >::value_type temp4 ;
  size_t val4 ;
  int ecode4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_insert" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_insert" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
  } else {
    swig::SwigPyIterator_T<std::vector< size_t >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "Size_T_Vector_insert" "', argument " "2"" of type '" "std::vector< size_t >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Size_T_Vector_insert" "', argument " "3"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg3 = static_cast< std::vector< size_t >::size_type >(val3);
  ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Size_T_Vector_insert" "', argument " "4"" of type '" "std::vector< size_t >::value_type""'");
  } 
  temp4 = static_cast< std::vector< size_t >::value_type >(val4);
  arg4 = &temp4;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      std_vector_Sl_size_t_Sg__insert__SWIG_1(arg1,arg2,arg3,(size_t const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Size_T_Vector_insert",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<size_t,std::allocator< size_t > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< size_t >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Size_T_Vector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Size_T_Vector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Size_T_Vector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    std::vector< size_t >::insert(std::vector< size_t >::iterator,std::vector< size_t >::value_type const &)\n"
    "    std::vector< size_t >::insert(std::vector< size_t >::iterator,std::vector< size_t >::size_type,std::vector< size_t >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  std::vector< size_t >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Size_T_Vector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_reserve" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Size_T_Vector_reserve" "', argument " "2"" of type '" "std::vector< size_t >::size_type""'");
  } 
  arg2 = static_cast< std::vector< size_t >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reserve(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Size_T_Vector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< size_t >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Size_T_Vector_capacity" "', argument " "1"" of type '" "std::vector< size_t > const *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((std::vector< size_t > const *)arg1)->capacity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Size_T_Vector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  std::vector< size_t > *arg1 = (std::vector< size_t > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Size_T_Vector" "', argument " "1"" of type '" "std::vector< size_t > *""'"); 
  }
  arg1 = reinterpret_cast< std::vector< size_t > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Size_T_Vector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_size_t_std__allocatorT_size_t_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_non_zeros_ui8(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "py_y", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:non_zeros_ui8",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)non_zeros_ui8(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_non_zeros_i32(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "py_y", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:non_zeros_i32",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)non_zeros_i32(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_non_zeros_f32(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "py_x",(char *) "py_y", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:non_zeros_f32",kwnames,&obj0,&obj1)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)non_zeros_f32(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rightVecProdAtIndices(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "py_ind",(char *) "py_x",(char *) "py_y", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:rightVecProdAtIndices",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  arg3 = obj2;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      rightVecProdAtIndices(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_generate2DGaussianSample(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt32 arg1 ;
  nupic::UInt32 arg2 ;
  nupic::UInt32 arg3 ;
  nupic::UInt32 arg4 ;
  nupic::Real32 arg5 ;
  nupic::Int32 arg6 = (nupic::Int32) -1 ;
  bool arg7 = (bool) true ;
  int val6 ;
  int ecode6 = 0 ;
  bool val7 ;
  int ecode7 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  char *  kwnames[] = {
    (char *) "nrows",(char *) "ncols",(char *) "nnzpr",(char *) "rf_x",(char *) "sigma",(char *) "seed",(char *) "sorted", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO|OO:generate2DGaussianSample",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(obj0);
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  if (obj5) {
    ecode6 = SWIG_AsVal_int(obj5, &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "generate2DGaussianSample" "', argument " "6"" of type '" "nupic::Int32""'");
    } 
    arg6 = static_cast< nupic::Int32 >(val6);
  }
  if (obj6) {
    ecode7 = SWIG_AsVal_bool(obj6, &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "generate2DGaussianSample" "', argument " "7"" of type '" "bool""'");
    } 
    arg7 = static_cast< bool >(val7);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)generate2DGaussianSample(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_getSegmentActivityLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  bool arg3 ;
  nupic::Real32 arg4 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "py_seg",(char *) "py_state",(char *) "connectedSynapsesOnly",(char *) "connectedPerm", NULL 
  };
  nupic::UInt32 result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:getSegmentActivityLevel",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "getSegmentActivityLevel" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt32)getSegmentActivityLevel(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_isSegmentActive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  nupic::Real32 arg3 ;
  nupic::UInt32 arg4 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "py_seg",(char *) "py_state",(char *) "connectedPerm",(char *) "activationThreshold", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:isSegmentActive",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  arg1 = obj0;
  arg2 = obj1;
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)isSegmentActive(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_CState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_CState",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::CState *)new nupic::algorithms::Cells4::CState();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__CState, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_CState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CState" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_initialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "nCells", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CState_initialize",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_initialize" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->initialize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_usePythonMemory(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  nupic::Byte *arg2 = (nupic::Byte *) 0 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "pData",(char *) "nCells", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:CState_usePythonMemory",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_usePythonMemory" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CState_usePythonMemory" "', argument " "2"" of type '" "nupic::Byte *""'");
  }
  arg2 = reinterpret_cast< nupic::Byte * >(buf2);
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->usePythonMemory(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_isSet(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CState_isSet",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_isSet" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::CState const *)arg1)->isSet(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CState_set",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_resetAll(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_resetAll" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resetAll();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_arrayPtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Byte *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_arrayPtr" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Byte *)((nupic::algorithms::Cells4::CState const *)arg1)->arrayPtr();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CState_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CState_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CState_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CState_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CState *arg1 = (nupic::algorithms::Cells4::CState *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CState_version" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CState const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::CState const *)arg1)->version();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *CState_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__CState, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_CStateIndexed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_CStateIndexed",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::CStateIndexed *)new nupic::algorithms::Cells4::CStateIndexed();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CStateIndexed_cellsOn(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  bool arg2 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "fSorted", NULL 
  };
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:CStateIndexed_cellsOn",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CStateIndexed_cellsOn" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_bool(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CStateIndexed_cellsOn" "', argument " "2"" of type '" "bool""'");
    } 
    arg2 = static_cast< bool >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->cellsOn(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CStateIndexed_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CStateIndexed_set",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CStateIndexed_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->set(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CStateIndexed_resetAll(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CStateIndexed_resetAll" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resetAll();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CStateIndexed_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:CStateIndexed_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CStateIndexed_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CStateIndexed_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CStateIndexed_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CStateIndexed_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CStateIndexed_version" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::CStateIndexed const *)arg1)->version();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_CStateIndexed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::CStateIndexed *arg1 = (nupic::algorithms::Cells4::CStateIndexed *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CStateIndexed" "', argument " "1"" of type '" "nupic::algorithms::Cells4::CStateIndexed *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *CStateIndexed_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN int Swig_var__numTiers_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable _numTiers is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var__numTiers_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::_numTiers));
  return pyobj;
}


SWIGINTERN int Swig_var__dutyCycleTiers_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable _dutyCycleTiers is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var__dutyCycleTiers_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(nupic::algorithms::Cells4::_dutyCycleTiers), SWIGTYPE_p_unsigned_int,  0 );
  return pyobj;
}


SWIGINTERN int Swig_var__dutyCycleAlphas_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable _dutyCycleAlphas is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var__dutyCycleAlphas_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(nupic::algorithms::Cells4::_dutyCycleAlphas), SWIGTYPE_p_float,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_InSynapseOrder___call__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapseOrder *arg1 = (nupic::algorithms::Cells4::InSynapseOrder *) 0 ;
  InSynapse *arg2 = 0 ;
  InSynapse *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a",(char *) "b", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:InSynapseOrder___call__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapseOrder, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "InSynapseOrder___call__" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapseOrder const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapseOrder * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_InSynapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "InSynapseOrder___call__" "', argument " "2"" of type '" "InSynapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "InSynapseOrder___call__" "', argument " "2"" of type '" "InSynapse const &""'"); 
  }
  arg2 = reinterpret_cast< InSynapse * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_InSynapse,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "InSynapseOrder___call__" "', argument " "3"" of type '" "InSynapse const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "InSynapseOrder___call__" "', argument " "3"" of type '" "InSynapse const &""'"); 
  }
  arg3 = reinterpret_cast< InSynapse * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::InSynapseOrder const *)arg1)->operator ()((InSynapse const &)*arg2,(InSynapse const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_InSynapseOrder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapseOrder *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_InSynapseOrder",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::InSynapseOrder *)new nupic::algorithms::Cells4::InSynapseOrder();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__InSynapseOrder, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_InSynapseOrder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapseOrder *arg1 = (nupic::algorithms::Cells4::InSynapseOrder *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapseOrder, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_InSynapseOrder" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapseOrder *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapseOrder * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *InSynapseOrder_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__InSynapseOrder, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Segment__totalActivations_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Segment__totalActivations_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__totalActivations_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  if (arg1) (arg1)->_totalActivations = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__totalActivations_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__totalActivations_get" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  result = (nupic::UInt) ((arg1)->_totalActivations);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__positiveActivations_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Segment__positiveActivations_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__positiveActivations_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  if (arg1) (arg1)->_positiveActivations = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__positiveActivations_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__positiveActivations_get" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  result = (nupic::UInt) ((arg1)->_positiveActivations);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastActiveIteration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Segment__lastActiveIteration_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastActiveIteration_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  if (arg1) (arg1)->_lastActiveIteration = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastActiveIteration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastActiveIteration_get" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  result = (nupic::UInt) ((arg1)->_lastActiveIteration);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastPosDutyCycle_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Segment__lastPosDutyCycle_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastPosDutyCycle_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->_lastPosDutyCycle = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastPosDutyCycle_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastPosDutyCycle_get" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  result = (nupic::Real) ((arg1)->_lastPosDutyCycle);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastPosDutyCycleIteration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Segment__lastPosDutyCycleIteration_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastPosDutyCycleIteration_set" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  if (arg1) (arg1)->_lastPosDutyCycleIteration = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment__lastPosDutyCycleIteration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment__lastPosDutyCycleIteration_get" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  result = (nupic::UInt) ((arg1)->_lastPosDutyCycleIteration);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Segment__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *)new nupic::algorithms::Cells4::Segment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Segment__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  SwigValueWrapper< std::vector< InSynapse,std::allocator< nupic::algorithms::Cells4::InSynapse > > > arg1 ;
  nupic::Real arg2 ;
  bool arg3 ;
  nupic::Real arg4 ;
  nupic::UInt arg5 ;
  void *argp1 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  {
    res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t,  0  | 0);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment::InSynapses""'"); 
    }  
    if (!argp1) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment::InSynapses""'");
    } else {
      nupic::algorithms::Cells4::Segment::InSynapses * temp = reinterpret_cast< nupic::algorithms::Cells4::Segment::InSynapses * >(argp1);
      arg1 = *temp;
      if (SWIG_IsNewObj(res1)) delete temp;
    }
  }
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_Segment" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(swig_obj[3]);
  }
  {
    arg5 = (nupic::UInt32) PyLong_AsLong(swig_obj[4]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *)new nupic::algorithms::Cells4::Segment(arg1,arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Segment__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__algorithms__Cells4__Segment,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *)new nupic::algorithms::Cells4::Segment((nupic::algorithms::Cells4::Segment const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Segment(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[6];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_Segment",0,5,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 5) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_Segment__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_Segment__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_Segment__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Segment'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::Segment::Segment()\n"
    "    nupic::algorithms::Cells4::Segment::Segment(nupic::algorithms::Cells4::Segment::InSynapses,nupic::Real,bool,nupic::Real,nupic::UInt)\n"
    "    nupic::algorithms::Cells4::Segment::Segment(nupic::algorithms::Cells4::Segment const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Segment_invariants(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_invariants" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->invariants();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_checkConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "permConnected", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_checkConnected",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_checkConnected" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->checkConnected(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_empty" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_size" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_isSequenceSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_isSequenceSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->isSequenceSegment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_frequency(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_frequency" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real *) &(arg1)->frequency();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getFrequency(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getFrequency" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::Cells4::Segment const *)arg1)->getFrequency();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_nConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_nConnected" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->nConnected();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getTotalActivations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getTotalActivations" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->getTotalActivations();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getPositiveActivations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getPositiveActivations" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->getPositiveActivations();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getLastActiveIteration(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getLastActiveIteration" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->getLastActiveIteration();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getLastPosDutyCycle(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getLastPosDutyCycle" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::Cells4::Segment const *)arg1)->getLastPosDutyCycle();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getLastPosDutyCycleIteration(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getLastPosDutyCycleIteration" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->getLastPosDutyCycleIteration();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_has(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "srcCellIdx", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_has",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_has" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->has(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_setPermanence(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  nupic::Real arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Segment_setPermanence",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_setPermanence" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPermanence(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getPermanence(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_getPermanence",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getPermanence" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::Cells4::Segment const *)arg1)->getPermanence(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getSrcCellIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "idx", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_getSrcCellIdx",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getSrcCellIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->getSrcCellIdx(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_getSrcCellIndices(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "srcCells", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_getSrcCellIndices",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_getSrcCellIndices" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_getSrcCellIndices" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_getSrcCellIndices" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Segment const *)arg1)->getSrcCellIndices(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_clear" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_addSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > *arg2 = 0 ;
  nupic::Real arg3 ;
  nupic::Real arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "srcCells",(char *) "initStrength",(char *) "permConnected", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Segment_addSynapses",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_addSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_addSynapses" "', argument " "2"" of type '" "std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_addSynapses" "', argument " "2"" of type '" "std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->addSynapses((std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > const &)*arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_recomputeConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "permConnected", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_recomputeConnected",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_recomputeConnected" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->recomputeConnected(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_decaySynapses2(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::Real arg2 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg3 = 0 ;
  nupic::Real arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "decay",(char *) "removed",(char *) "permConnected", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Segment_decaySynapses2",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_decaySynapses2" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Segment_decaySynapses2" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_decaySynapses2" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp3);
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->decaySynapses2(arg2,*arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_decaySynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::Real arg2 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg3 = 0 ;
  nupic::Real arg4 ;
  bool arg5 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "decay",(char *) "removed",(char *) "permConnected",(char *) "doDecay", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:Segment_decaySynapses",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_decaySynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Segment_decaySynapses" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_decaySynapses" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp3);
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Segment_decaySynapses" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->decaySynapses(arg2,*arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_freeNSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg3 = 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg4 = 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg5 = 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg6 = 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg7 = 0 ;
  nupic::UInt arg8 ;
  nupic::UInt arg9 ;
  nupic::Real arg10 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  PyObject * obj9 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "numToFree",(char *) "inactiveSynapseIndices",(char *) "inactiveSegmentIndices",(char *) "activeSynapseIndices",(char *) "activeSegmentIndices",(char *) "removed",(char *) "verbosity",(char *) "nCellsPerCol",(char *) "permMax", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOOOO:Segment_freeNSynapses",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_freeNSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Segment_freeNSynapses" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_freeNSynapses" "', argument " "3"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp3);
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Segment_freeNSynapses" "', argument " "4"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_freeNSynapses" "', argument " "4"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp4);
  res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Segment_freeNSynapses" "', argument " "5"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp5) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_freeNSynapses" "', argument " "5"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg5 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Segment_freeNSynapses" "', argument " "6"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_freeNSynapses" "', argument " "6"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp6);
  res7 = SWIG_ConvertPtr(obj6, &argp7, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Segment_freeNSynapses" "', argument " "7"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp7) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_freeNSynapses" "', argument " "7"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg7 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp7);
  {
    arg8 = (nupic::UInt32) PyLong_AsLong(obj7);
  }
  {
    arg9 = (nupic::UInt32) PyLong_AsLong(obj8);
  }
  {
    arg10 = (nupic::Real32) PyFloat_AsDouble(obj9);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->freeNSynapses(arg2,*arg3,*arg4,*arg5,*arg6,*arg7,arg8,arg9,arg10);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_isActive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::algorithms::Cells4::CState *arg2 = 0 ;
  nupic::Real arg3 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activities",(char *) "permConnected",(char *) "activationThreshold", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Segment_isActive",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_isActive" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_isActive" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_isActive" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Segment const *)arg1)->isActive((nupic::algorithms::Cells4::CState const &)*arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_computeActivity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::algorithms::Cells4::CState *arg2 = 0 ;
  nupic::Real arg3 ;
  bool arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activities",(char *) "permConnected",(char *) "connectedSynapsesOnly", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Segment_computeActivity",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_computeActivity" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_computeActivity" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_computeActivity" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  ecode4 = SWIG_AsVal_bool(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Segment_computeActivity" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->computeActivity((nupic::algorithms::Cells4::CState const &)*arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_dutyCycle(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  nupic::UInt arg2 ;
  bool arg3 ;
  bool arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "iteration",(char *) "active",(char *) "readOnly", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Segment_dutyCycle",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_dutyCycle" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Segment_dutyCycle" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  ecode4 = SWIG_AsVal_bool(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Segment_dutyCycle" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->dutyCycle(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_atDutyCycleTier(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt arg1 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "iteration", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Segment_atDutyCycleTier",kwnames,&obj0)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(obj0);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic::algorithms::Cells4::Segment::atDutyCycleTier(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_persistentSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_persistentSize" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Segment const *)arg1)->persistentSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_save" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Segment const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Segment_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Segment_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Segment_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Segment_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Segment_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Segment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Segment *arg1 = (nupic::algorithms::Cells4::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Segment, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Segment_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__Segment, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_SegmentUpdate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::SegmentUpdate *)new nupic::algorithms::Cells4::SegmentUpdate();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SegmentUpdate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt arg1 ;
  nupic::UInt arg2 ;
  bool arg3 ;
  nupic::UInt arg4 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > arg5 = (std::vector< nupic::UInt,std::allocator< nupic::UInt > >) std::vector< nupic::UInt >() ;
  bool arg6 = (bool) false ;
  bool arg7 = (bool) false ;
  nupic::algorithms::Cells4::Cells4 *arg8 = (nupic::algorithms::Cells4::Cells4 *) nullptr ;
  bool val3 ;
  int ecode3 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  bool val7 ;
  int ecode7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  nupic::algorithms::Cells4::SegmentUpdate *result = 0 ;
  
  if ((nobjs < 4) || (nobjs > 8)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_SegmentUpdate" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  if (swig_obj[4]) {
    {
      std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
      int res = swig::asptr(swig_obj[4], &ptr);
      if (!SWIG_IsOK(res) || !ptr) {
        SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_SegmentUpdate" "', argument " "5"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > >""'"); 
      }
      arg5 = *ptr;
      if (SWIG_IsNewObj(res)) delete ptr;
    }
  }
  if (swig_obj[5]) {
    ecode6 = SWIG_AsVal_bool(swig_obj[5], &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "new_SegmentUpdate" "', argument " "6"" of type '" "bool""'");
    } 
    arg6 = static_cast< bool >(val6);
  }
  if (swig_obj[6]) {
    ecode7 = SWIG_AsVal_bool(swig_obj[6], &val7);
    if (!SWIG_IsOK(ecode7)) {
      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "new_SegmentUpdate" "', argument " "7"" of type '" "bool""'");
    } 
    arg7 = static_cast< bool >(val7);
  }
  if (swig_obj[7]) {
    res8 = SWIG_ConvertPtr(swig_obj[7], &argp8,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
    if (!SWIG_IsOK(res8)) {
      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_SegmentUpdate" "', argument " "8"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
    }
    arg8 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp8);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::SegmentUpdate *)new nupic::algorithms::Cells4::SegmentUpdate(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SegmentUpdate__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::Cells4::SegmentUpdate *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_SegmentUpdate" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_SegmentUpdate" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::SegmentUpdate *)new nupic::algorithms::Cells4::SegmentUpdate((nupic::algorithms::Cells4::SegmentUpdate const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SegmentUpdate(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[9];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_SegmentUpdate",0,8,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if ((argc >= 4) && (argc <= 8)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 4) {
        {
          int res = swig::asptr(argv[4], (std::vector<unsigned int,std::allocator< unsigned int > >**)(0));
          _v = SWIG_CheckState(res);
        }
        if (!_v) goto check_3;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
        if (argc > 5) {
          {
            {
              int res = SWIG_AsVal_bool(argv[5], NULL);
              _v = SWIG_CheckState(res);
            }
          }
          if (!_v) goto check_3;
          _ranki += _v*_pi;
          _rankm += _pi;
          _pi *= SWIG_MAXCASTRANK;
          if (argc > 6) {
            {
              {
                int res = SWIG_AsVal_bool(argv[6], NULL);
                _v = SWIG_CheckState(res);
              }
            }
            if (!_v) goto check_3;
            _ranki += _v*_pi;
            _rankm += _pi;
            _pi *= SWIG_MAXCASTRANK;
            if (argc > 7) {
              {
                void *vptr = 0;
                int res = SWIG_ConvertPtr(argv[7], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
                _v = SWIG_CheckState(res);
              }
              if (!_v) goto check_3;
              _ranki += _v*_pi;
              _rankm += _pi;
              _pi *= SWIG_MAXCASTRANK;
            }
          }
        }
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_SegmentUpdate__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_SegmentUpdate__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_SegmentUpdate__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_SegmentUpdate'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::SegmentUpdate::SegmentUpdate()\n"
    "    nupic::algorithms::Cells4::SegmentUpdate::SegmentUpdate(nupic::UInt,nupic::UInt,bool,nupic::UInt,std::vector< nupic::UInt,std::allocator< nupic::UInt > >,bool,bool,nupic::algorithms::Cells4::Cells4 *)\n"
    "    nupic::algorithms::Cells4::SegmentUpdate::SegmentUpdate(nupic::algorithms::Cells4::SegmentUpdate const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_isSequenceSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_isSequenceSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->isSequenceSegment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_cellIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_cellIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->cellIdx();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_segIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_segIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->segIdx();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_timeStamp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_timeStamp" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->timeStamp();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::const_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_begin" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const nupic::algorithms::Cells4::SegmentUpdate::const_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::vector< unsigned int >::const_iterator > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_end" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const nupic::algorithms::Cells4::SegmentUpdate::const_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_size" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_empty" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_isNewSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_isNewSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->isNewSegment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_isPhase1Segment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_isPhase1Segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->isPhase1Segment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_isWeaklyPredicting(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_isWeaklyPredicting" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->isWeaklyPredicting();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_invariants(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  nupic::algorithms::Cells4::Cells4 *arg2 = (nupic::algorithms::Cells4::Cells4 *) nullptr ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cells", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:SegmentUpdate_invariants",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_invariants" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  if (obj1) {
    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SegmentUpdate_invariants" "', argument " "2"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
    }
    arg2 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->invariants(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SegmentUpdate_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_save" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SegmentUpdate_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SegmentUpdate_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::SegmentUpdate const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentUpdate_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SegmentUpdate_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentUpdate_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SegmentUpdate_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SegmentUpdate_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_SegmentUpdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::SegmentUpdate *arg1 = (nupic::algorithms::Cells4::SegmentUpdate *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SegmentUpdate" "', argument " "1"" of type '" "nupic::algorithms::Cells4::SegmentUpdate *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *SegmentUpdate_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_OutSynapse__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt arg1 = (nupic::UInt) (UInt) -1 ;
  nupic::UInt arg2 = (nupic::UInt) (UInt) -1 ;
  nupic::algorithms::Cells4::OutSynapse *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 2)) SWIG_fail;
  if (swig_obj[0]) {
    {
      arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
    }
  }
  if (swig_obj[1]) {
    {
      arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::OutSynapse *)new nupic::algorithms::Cells4::OutSynapse(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_OutSynapse__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::Cells4::OutSynapse *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_OutSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_OutSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::OutSynapse *)new nupic::algorithms::Cells4::OutSynapse((nupic::algorithms::Cells4::OutSynapse const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_OutSynapse(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_OutSynapse",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if ((argc >= 0) && (argc <= 2)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      if (argc > 0) {
        {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_1;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
        if (argc > 1) {
          {
            {
              int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
              _v = SWIG_CheckState(res);
            }
          }
          if (!_v) goto check_1;
          _ranki += _v*_pi;
          _rankm += _pi;
          _pi *= SWIG_MAXCASTRANK;
        }
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_OutSynapse__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_OutSynapse__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_OutSynapse'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::OutSynapse::OutSynapse(nupic::UInt,nupic::UInt)\n"
    "    nupic::algorithms::Cells4::OutSynapse::OutSynapse(nupic::algorithms::Cells4::OutSynapse const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_OutSynapse_dstCellIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OutSynapse_dstCellIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::OutSynapse const *)arg1)->dstCellIdx();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OutSynapse_dstSegIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OutSynapse_dstSegIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::OutSynapse const *)arg1)->dstSegIdx();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OutSynapse_goesTo(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dstCellIdx",(char *) "dstSegIdx", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:OutSynapse_goesTo",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OutSynapse_goesTo" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::OutSynapse const *)arg1)->goesTo(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OutSynapse_equals(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  nupic::algorithms::Cells4::OutSynapse *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "o", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:OutSynapse_equals",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OutSynapse_equals" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OutSynapse_equals" "', argument " "2"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "OutSynapse_equals" "', argument " "2"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::OutSynapse const *)arg1)->equals((nupic::algorithms::Cells4::OutSynapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OutSynapse_invariants(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  nupic::algorithms::Cells4::Cells4 *arg2 = (nupic::algorithms::Cells4::Cells4 *) nullptr ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cells", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:OutSynapse_invariants",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OutSynapse_invariants" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  if (obj1) {
    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OutSynapse_invariants" "', argument " "2"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
    }
    arg2 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::OutSynapse const *)arg1)->invariants(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_OutSynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = (nupic::algorithms::Cells4::OutSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_OutSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *OutSynapse_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::OutSynapse *arg1 = 0 ;
  nupic::algorithms::Cells4::OutSynapse *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "a",(char *) "b", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:__eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__eq__" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__eq__" "', argument " "1"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__OutSynapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__eq__" "', argument " "2"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__eq__" "', argument " "2"" of type '" "nupic::algorithms::Cells4::OutSynapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::OutSynapse * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)nupic::algorithms::Cells4::operator ==((nupic::algorithms::Cells4::OutSynapse const &)*arg1,(nupic::algorithms::Cells4::OutSynapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_InSynapse__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::InSynapse *)new nupic::algorithms::Cells4::InSynapse();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_InSynapse__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::UInt arg1 ;
  nupic::Real arg2 ;
  nupic::algorithms::Cells4::InSynapse *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::InSynapse *)new nupic::algorithms::Cells4::InSynapse(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_InSynapse__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *arg1 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::algorithms::Cells4::InSynapse *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse,  0  | 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_InSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse const &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_InSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse const &""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::InSynapse *)new nupic::algorithms::Cells4::InSynapse((nupic::algorithms::Cells4::InSynapse const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_InSynapse(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_InSynapse",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_float(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_InSynapse__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_InSynapse__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_InSynapse__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_InSynapse'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::InSynapse::InSynapse()\n"
    "    nupic::algorithms::Cells4::InSynapse::InSynapse(nupic::UInt,nupic::Real)\n"
    "    nupic::algorithms::Cells4::InSynapse::InSynapse(nupic::algorithms::Cells4::InSynapse const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_InSynapse_srcCellIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *arg1 = (nupic::algorithms::Cells4::InSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "InSynapse_srcCellIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::InSynapse const *)arg1)->srcCellIdx();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_InSynapse_permanence__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *arg1 = (nupic::algorithms::Cells4::InSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Real *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "InSynapse_permanence" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real *) &((nupic::algorithms::Cells4::InSynapse const *)arg1)->permanence();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(*result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_InSynapse_permanence__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *arg1 = (nupic::algorithms::Cells4::InSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  nupic::Real *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "InSynapse_permanence" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real *) &(arg1)->permanence();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_float, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_InSynapse_permanence(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"InSynapse_permanence",0,1,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_InSynapse_permanence__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_InSynapse_permanence__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'InSynapse_permanence'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::InSynapse::permanence() const\n"
    "    nupic::algorithms::Cells4::InSynapse::permanence()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_InSynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::InSynapse *arg1 = (nupic::algorithms::Cells4::InSynapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_InSynapse" "', argument " "1"" of type '" "nupic::algorithms::Cells4::InSynapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::InSynapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *InSynapse_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__InSynapse, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_Cell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_Cell",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Cell *)new nupic::algorithms::Cells4::Cell();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Cell, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_empty" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Cell const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_nSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_nSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cell const *)arg1)->nSynapses();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_size" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cell const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_nSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_nSegments" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cell const *)arg1)->nSegments();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_getNonEmptySegList(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_getNonEmptySegList" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::Cells4::Cell const *)arg1)->getNonEmptySegList();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_getSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segIdx", NULL 
  };
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cell_getSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_getSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *) &(arg1)->getSegment(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_getFreeSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  nupic::algorithms::Cells4::Segment::InSynapses *arg2 = 0 ;
  nupic::Real arg3 ;
  bool arg4 ;
  nupic::Real arg5 ;
  nupic::UInt arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synapses",(char *) "initFrequency",(char *) "sequenceSegmentFlag",(char *) "permConnected",(char *) "iteration", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:Cell_getFreeSegment",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_getFreeSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cell_getFreeSegment" "', argument " "2"" of type '" "nupic::algorithms::Cells4::Segment::InSynapses const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cell_getFreeSegment" "', argument " "2"" of type '" "nupic::algorithms::Cells4::Segment::InSynapses const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::Segment::InSynapses * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  ecode4 = SWIG_AsVal_bool(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Cell_getFreeSegment" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  {
    arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
  }
  {
    arg6 = (nupic::UInt32) PyLong_AsLong(obj5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->getFreeSegment((nupic::algorithms::Cells4::Segment::InSynapses const &)*arg2,arg3,arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_setSegmentOrder(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  bool arg1 ;
  bool val1 ;
  int ecode1 = 0 ;
  PyObject * obj0 = 0 ;
  char *  kwnames[] = {
    (char *) "matchPythonOrder", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:Cell_setSegmentOrder",kwnames,&obj0)) SWIG_fail;
  ecode1 = SWIG_AsVal_bool(obj0, &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Cell_setSegmentOrder" "', argument " "1"" of type '" "bool""'");
  } 
  arg1 = static_cast< bool >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic::algorithms::Cells4::Cell::setSegmentOrder(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_updateDutyCycle(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "iterations", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cell_updateDutyCycle",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_updateDutyCycle" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateDutyCycle(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_rebalanceSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_rebalanceSegments" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rebalanceSegments();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_getMostActiveSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_getMostActiveSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->getMostActiveSegment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_releaseSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segIdx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cell_releaseSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_releaseSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->releaseSegment(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_invariants(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  nupic::algorithms::Cells4::Cells4 *arg2 = (nupic::algorithms::Cells4::Cells4 *) nullptr ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *)"arg2", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Cell_invariants",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_invariants" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  if (obj1) {
    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cell_invariants" "', argument " "2"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
    }
    arg2 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Cell const *)arg1)->invariants(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_persistentSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_persistentSize" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cell const *)arg1)->persistentSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cell_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_save" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cell_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cell_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cell const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cell_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cell_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cell_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cell_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cell_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Cell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cell *arg1 = (nupic::algorithms::Cells4::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cell, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Cell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Cell_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__Cell, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN int Swig_var__MAX_CELLS_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable _MAX_CELLS is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var__MAX_CELLS_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::_MAX_CELLS));
  return pyobj;
}


SWIGINTERN int Swig_var__MAX_SEGS_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable _MAX_SEGS is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var__MAX_SEGS_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::_MAX_SEGS));
  return pyobj;
}


SWIGINTERN PyObject *_wrap_new_Cells4(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::UInt arg1 = (nupic::UInt) 0 ;
  nupic::UInt arg2 = (nupic::UInt) 0 ;
  nupic::UInt arg3 = (nupic::UInt) 1 ;
  nupic::UInt arg4 = (nupic::UInt) 1 ;
  nupic::UInt arg5 = (nupic::UInt) 1 ;
  nupic::UInt arg6 = (nupic::UInt) 1 ;
  nupic::Real arg7 = (nupic::Real) .5 ;
  nupic::Real arg8 = (nupic::Real) .8 ;
  nupic::Real arg9 = (nupic::Real) 1 ;
  nupic::Real arg10 = (nupic::Real) .1 ;
  nupic::Real arg11 = (nupic::Real) .1 ;
  nupic::Real arg12 = (nupic::Real) 0 ;
  bool arg13 = (bool) false ;
  int arg14 = (int) -1 ;
  bool arg15 = (bool) false ;
  bool arg16 = (bool) false ;
  bool val13 ;
  int ecode13 = 0 ;
  int val14 ;
  int ecode14 = 0 ;
  bool val15 ;
  int ecode15 = 0 ;
  bool val16 ;
  int ecode16 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  PyObject * obj9 = 0 ;
  PyObject * obj10 = 0 ;
  PyObject * obj11 = 0 ;
  PyObject * obj12 = 0 ;
  PyObject * obj13 = 0 ;
  PyObject * obj14 = 0 ;
  PyObject * obj15 = 0 ;
  char *  kwnames[] = {
    (char *) "nColumns",(char *) "nCellsPerCol",(char *) "activationThreshold",(char *) "minThreshold",(char *) "newSynapseCount",(char *) "segUpdateValidDuration",(char *) "permInitial",(char *) "permConnected",(char *) "permMax",(char *) "permDec",(char *) "permInc",(char *) "globalDecay",(char *) "doPooling",(char *) "seed",(char *) "initFromCpp",(char *) "checkSynapseConsistency", NULL 
  };
  nupic::algorithms::Cells4::Cells4 *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOOOOOOOOOOOOOO:new_Cells4",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15)) SWIG_fail;
  if (obj0) {
    {
      arg1 = (nupic::UInt32) PyLong_AsLong(obj0);
    }
  }
  if (obj1) {
    {
      arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
    }
  }
  if (obj2) {
    {
      arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
    }
  }
  if (obj3) {
    {
      arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
    }
  }
  if (obj4) {
    {
      arg5 = (nupic::UInt32) PyLong_AsLong(obj4);
    }
  }
  if (obj5) {
    {
      arg6 = (nupic::UInt32) PyLong_AsLong(obj5);
    }
  }
  if (obj6) {
    {
      arg7 = (nupic::Real32) PyFloat_AsDouble(obj6);
    }
  }
  if (obj7) {
    {
      arg8 = (nupic::Real32) PyFloat_AsDouble(obj7);
    }
  }
  if (obj8) {
    {
      arg9 = (nupic::Real32) PyFloat_AsDouble(obj8);
    }
  }
  if (obj9) {
    {
      arg10 = (nupic::Real32) PyFloat_AsDouble(obj9);
    }
  }
  if (obj10) {
    {
      arg11 = (nupic::Real32) PyFloat_AsDouble(obj10);
    }
  }
  if (obj11) {
    {
      arg12 = (nupic::Real32) PyFloat_AsDouble(obj11);
    }
  }
  if (obj12) {
    ecode13 = SWIG_AsVal_bool(obj12, &val13);
    if (!SWIG_IsOK(ecode13)) {
      SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_Cells4" "', argument " "13"" of type '" "bool""'");
    } 
    arg13 = static_cast< bool >(val13);
  }
  if (obj13) {
    ecode14 = SWIG_AsVal_int(obj13, &val14);
    if (!SWIG_IsOK(ecode14)) {
      SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_Cells4" "', argument " "14"" of type '" "int""'");
    } 
    arg14 = static_cast< int >(val14);
  }
  if (obj14) {
    ecode15 = SWIG_AsVal_bool(obj14, &val15);
    if (!SWIG_IsOK(ecode15)) {
      SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "new_Cells4" "', argument " "15"" of type '" "bool""'");
    } 
    arg15 = static_cast< bool >(val15);
  }
  if (obj15) {
    ecode16 = SWIG_AsVal_bool(obj15, &val16);
    if (!SWIG_IsOK(ecode16)) {
      SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_Cells4" "', argument " "16"" of type '" "bool""'");
    } 
    arg16 = static_cast< bool >(val16);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Cells4 *)new nupic::algorithms::Cells4::Cells4(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_initialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 = (nupic::UInt) 0 ;
  nupic::UInt arg3 = (nupic::UInt) 0 ;
  nupic::UInt arg4 = (nupic::UInt) 1 ;
  nupic::UInt arg5 = (nupic::UInt) 1 ;
  nupic::UInt arg6 = (nupic::UInt) 1 ;
  nupic::UInt arg7 = (nupic::UInt) 1 ;
  nupic::Real arg8 = (nupic::Real) .5 ;
  nupic::Real arg9 = (nupic::Real) .8 ;
  nupic::Real arg10 = (nupic::Real) 1 ;
  nupic::Real arg11 = (nupic::Real) .1 ;
  nupic::Real arg12 = (nupic::Real) .1 ;
  nupic::Real arg13 = (nupic::Real) .1 ;
  bool arg14 = (bool) false ;
  bool arg15 = (bool) false ;
  bool arg16 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val14 ;
  int ecode14 = 0 ;
  bool val15 ;
  int ecode15 = 0 ;
  bool val16 ;
  int ecode16 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  PyObject * obj9 = 0 ;
  PyObject * obj10 = 0 ;
  PyObject * obj11 = 0 ;
  PyObject * obj12 = 0 ;
  PyObject * obj13 = 0 ;
  PyObject * obj14 = 0 ;
  PyObject * obj15 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "nColumns",(char *) "nCellsPerCol",(char *) "activationThreshold",(char *) "minThreshold",(char *) "newSynapseCount",(char *) "segUpdateValidDuration",(char *) "permInitial",(char *) "permConnected",(char *) "permMax",(char *) "permDec",(char *) "permInc",(char *) "globalDecay",(char *) "doPooling",(char *) "initFromCpp",(char *) "checkSynapseConsistency", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOOOOOOOOOOOOO:Cells4_initialize",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_initialize" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  if (obj1) {
    {
      arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
    }
  }
  if (obj2) {
    {
      arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
    }
  }
  if (obj3) {
    {
      arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
    }
  }
  if (obj4) {
    {
      arg5 = (nupic::UInt32) PyLong_AsLong(obj4);
    }
  }
  if (obj5) {
    {
      arg6 = (nupic::UInt32) PyLong_AsLong(obj5);
    }
  }
  if (obj6) {
    {
      arg7 = (nupic::UInt32) PyLong_AsLong(obj6);
    }
  }
  if (obj7) {
    {
      arg8 = (nupic::Real32) PyFloat_AsDouble(obj7);
    }
  }
  if (obj8) {
    {
      arg9 = (nupic::Real32) PyFloat_AsDouble(obj8);
    }
  }
  if (obj9) {
    {
      arg10 = (nupic::Real32) PyFloat_AsDouble(obj9);
    }
  }
  if (obj10) {
    {
      arg11 = (nupic::Real32) PyFloat_AsDouble(obj10);
    }
  }
  if (obj11) {
    {
      arg12 = (nupic::Real32) PyFloat_AsDouble(obj11);
    }
  }
  if (obj12) {
    {
      arg13 = (nupic::Real32) PyFloat_AsDouble(obj12);
    }
  }
  if (obj13) {
    ecode14 = SWIG_AsVal_bool(obj13, &val14);
    if (!SWIG_IsOK(ecode14)) {
      SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "Cells4_initialize" "', argument " "14"" of type '" "bool""'");
    } 
    arg14 = static_cast< bool >(val14);
  }
  if (obj14) {
    ecode15 = SWIG_AsVal_bool(obj14, &val15);
    if (!SWIG_IsOK(ecode15)) {
      SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "Cells4_initialize" "', argument " "15"" of type '" "bool""'");
    } 
    arg15 = static_cast< bool >(val15);
  }
  if (obj15) {
    ecode16 = SWIG_AsVal_bool(obj15, &val16);
    if (!SWIG_IsOK(ecode16)) {
      SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "Cells4_initialize" "', argument " "16"" of type '" "bool""'");
    } 
    arg16 = static_cast< bool >(val16);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->initialize(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Cells4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Cells4" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_version" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->version();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setStatePointers__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Byte *arg2 = (nupic::Byte *) 0 ;
  nupic::Byte *arg3 = (nupic::Byte *) 0 ;
  nupic::Byte *arg4 = (nupic::Byte *) 0 ;
  nupic::Byte *arg5 = (nupic::Byte *) 0 ;
  nupic::Real *arg6 = (nupic::Real *) 0 ;
  nupic::Real *arg7 = (nupic::Real *) 0 ;
  nupic::Real *arg8 = (nupic::Real *) 0 ;
  nupic::Real *arg9 = (nupic::Real *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  int res5 ;
  char *buf5 = 0 ;
  int alloc5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  
  if ((nobjs < 9) || (nobjs > 9)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setStatePointers" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_setStatePointers" "', argument " "2"" of type '" "nupic::Byte *""'");
  }
  arg2 = reinterpret_cast< nupic::Byte * >(buf2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_setStatePointers" "', argument " "3"" of type '" "nupic::Byte *""'");
  }
  arg3 = reinterpret_cast< nupic::Byte * >(buf3);
  res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_setStatePointers" "', argument " "4"" of type '" "nupic::Byte *""'");
  }
  arg4 = reinterpret_cast< nupic::Byte * >(buf4);
  res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5);
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_setStatePointers" "', argument " "5"" of type '" "nupic::Byte *""'");
  }
  arg5 = reinterpret_cast< nupic::Byte * >(buf5);
  res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Cells4_setStatePointers" "', argument " "6"" of type '" "nupic::Real *""'"); 
  }
  arg6 = reinterpret_cast< nupic::Real * >(argp6);
  res7 = SWIG_ConvertPtr(swig_obj[6], &argp7,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Cells4_setStatePointers" "', argument " "7"" of type '" "nupic::Real *""'"); 
  }
  arg7 = reinterpret_cast< nupic::Real * >(argp7);
  res8 = SWIG_ConvertPtr(swig_obj[7], &argp8,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res8)) {
    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "Cells4_setStatePointers" "', argument " "8"" of type '" "nupic::Real *""'"); 
  }
  arg8 = reinterpret_cast< nupic::Real * >(argp8);
  res9 = SWIG_ConvertPtr(swig_obj[8], &argp9,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res9)) {
    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "Cells4_setStatePointers" "', argument " "9"" of type '" "nupic::Real *""'"); 
  }
  arg9 = reinterpret_cast< nupic::Real * >(argp9);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setStatePointers(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getStatePointers(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Byte **arg2 = 0 ;
  nupic::Byte **arg3 = 0 ;
  nupic::Byte **arg4 = 0 ;
  nupic::Byte **arg5 = 0 ;
  nupic::Real **arg6 = 0 ;
  nupic::Real **arg7 = 0 ;
  nupic::Real **arg8 = 0 ;
  nupic::Real **arg9 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  void *argp7 = 0 ;
  int res7 = 0 ;
  void *argp8 = 0 ;
  int res8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeT",(char *) "activeT1",(char *) "predT",(char *) "predT1",(char *) "colConfidenceT",(char *) "colConfidenceT1",(char *) "confidenceT",(char *) "confidenceT1", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOOO:Cells4_getStatePointers",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getStatePointers" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_getStatePointers" "', argument " "2"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "2"" of type '" "nupic::Byte *&""'"); 
  }
  arg2 = reinterpret_cast< nupic::Byte ** >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_getStatePointers" "', argument " "3"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "3"" of type '" "nupic::Byte *&""'"); 
  }
  arg3 = reinterpret_cast< nupic::Byte ** >(argp3);
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_getStatePointers" "', argument " "4"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "4"" of type '" "nupic::Byte *&""'"); 
  }
  arg4 = reinterpret_cast< nupic::Byte ** >(argp4);
  res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_getStatePointers" "', argument " "5"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp5) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "5"" of type '" "nupic::Byte *&""'"); 
  }
  arg5 = reinterpret_cast< nupic::Byte ** >(argp5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_p_float,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Cells4_getStatePointers" "', argument " "6"" of type '" "nupic::Real *&""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "6"" of type '" "nupic::Real *&""'"); 
  }
  arg6 = reinterpret_cast< nupic::Real ** >(argp6);
  res7 = SWIG_ConvertPtr(obj6, &argp7, SWIGTYPE_p_p_float,  0 );
  if (!SWIG_IsOK(res7)) {
    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Cells4_getStatePointers" "', argument " "7"" of type '" "nupic::Real *&""'"); 
  }
  if (!argp7) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "7"" of type '" "nupic::Real *&""'"); 
  }
  arg7 = reinterpret_cast< nupic::Real ** >(argp7);
  res8 = SWIG_ConvertPtr(obj7, &argp8, SWIGTYPE_p_p_float,  0 );
  if (!SWIG_IsOK(res8)) {
    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "Cells4_getStatePointers" "', argument " "8"" of type '" "nupic::Real *&""'"); 
  }
  if (!argp8) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "8"" of type '" "nupic::Real *&""'"); 
  }
  arg8 = reinterpret_cast< nupic::Real ** >(argp8);
  res9 = SWIG_ConvertPtr(obj8, &argp9, SWIGTYPE_p_p_float,  0 );
  if (!SWIG_IsOK(res9)) {
    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "Cells4_getStatePointers" "', argument " "9"" of type '" "nupic::Real *&""'"); 
  }
  if (!argp9) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getStatePointers" "', argument " "9"" of type '" "nupic::Real *&""'"); 
  }
  arg9 = reinterpret_cast< nupic::Real ** >(argp9);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cells4 const *)arg1)->getStatePointers(*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getLearnStatePointers(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Byte **arg2 = 0 ;
  nupic::Byte **arg3 = 0 ;
  nupic::Byte **arg4 = 0 ;
  nupic::Byte **arg5 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeT",(char *) "activeT1",(char *) "predT",(char *) "predT1", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:Cells4_getLearnStatePointers",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getLearnStatePointers" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_getLearnStatePointers" "', argument " "2"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getLearnStatePointers" "', argument " "2"" of type '" "nupic::Byte *&""'"); 
  }
  arg2 = reinterpret_cast< nupic::Byte ** >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_getLearnStatePointers" "', argument " "3"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getLearnStatePointers" "', argument " "3"" of type '" "nupic::Byte *&""'"); 
  }
  arg3 = reinterpret_cast< nupic::Byte ** >(argp3);
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_getLearnStatePointers" "', argument " "4"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getLearnStatePointers" "', argument " "4"" of type '" "nupic::Byte *&""'"); 
  }
  arg4 = reinterpret_cast< nupic::Byte ** >(argp4);
  res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_p_char,  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_getLearnStatePointers" "', argument " "5"" of type '" "nupic::Byte *&""'"); 
  }
  if (!argp5) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getLearnStatePointers" "', argument " "5"" of type '" "nupic::Byte *&""'"); 
  }
  arg5 = reinterpret_cast< nupic::Byte ** >(argp5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cells4 const *)arg1)->getLearnStatePointers(*arg2,*arg3,*arg4,*arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nSegments" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nSegments();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nCells(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nCells" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nCells();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nColumns(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nColumns" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nColumns();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nCellsPerCol(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nCellsPerCol" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nCellsPerCol();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMinThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMinThreshold" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMinThreshold();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getPermConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getPermConnected" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getPermConnected();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getVerbosity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getVerbosity" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getVerbosity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMaxAge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMaxAge" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMaxAge();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getPamLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getPamLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getPamLength();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMaxInfBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMaxInfBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMaxInfBacktrack();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMaxLrnBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMaxLrnBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMaxLrnBacktrack();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getPamCounter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getPamCounter" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getPamCounter();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMaxSeqLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMaxSeqLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMaxSeqLength();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getAvgLearnedSeqLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getAvgLearnedSeqLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getAvgLearnedSeqLength();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getNLrnIterations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getNLrnIterations" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getNLrnIterations();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getmaxSegmentsPerCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getmaxSegmentsPerCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Int)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getmaxSegmentsPerCell();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getMaxSynapsesPerCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getMaxSynapsesPerCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Int)((nupic::algorithms::Cells4::Cells4 const *)arg1)->getMaxSynapsesPerCell();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getCheckSynapseConsistency(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getCheckSynapseConsistency" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->getCheckSynapseConsistency();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxInfBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "t", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxInfBacktrack",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxInfBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxInfBacktrack(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxLrnBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "t", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxLrnBacktrack",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxLrnBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxLrnBacktrack(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setVerbosity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setVerbosity",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setVerbosity" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setVerbosity(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxAge(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "a", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxAge",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxAge" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxAge(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxSeqLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxSeqLength",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxSeqLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxSeqLength(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setCheckSynapseConsistency(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "val", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setCheckSynapseConsistency",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setCheckSynapseConsistency" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_setCheckSynapseConsistency" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setCheckSynapseConsistency(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxSegmentsPerCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "maxSegs", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxSegmentsPerCell",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxSegmentsPerCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_setMaxSegmentsPerCell" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxSegmentsPerCell(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setMaxSynapsesPerCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "maxSyns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setMaxSynapsesPerCell",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setMaxSynapsesPerCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_setMaxSynapsesPerCell" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxSynapsesPerCell(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setPamLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "pl", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setPamLength",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setPamLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPamLength(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nSegmentsOnCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_nSegmentsOnCell",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nSegmentsOnCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nSegmentsOnCell(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nSynapses();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4___nSegmentsOnCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4___nSegmentsOnCell",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4___nSegmentsOnCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->__nSegmentsOnCell(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_nSynapsesInCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_nSynapsesInCell",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_nSynapsesInCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->nSynapsesInCell(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol", NULL 
  };
  nupic::algorithms::Cells4::Cell *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_getCell",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getCell" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Cell *)(arg1)->getCell(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getCellIdx(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_getCellIdx",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getCellIdx" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->getCellIdx(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol",(char *) "segIdx", NULL 
  };
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Cells4_getSegment",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *)(arg1)->getSegment(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_segment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx",(char *) "segIdx", NULL 
  };
  nupic::algorithms::Cells4::Segment *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_segment",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_segment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::Cells4::Segment *) &(arg1)->segment(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__Cells4__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_compute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Real *arg2 = (nupic::Real *) 0 ;
  nupic::Real *arg3 = (nupic::Real *) 0 ;
  bool arg4 ;
  bool arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_compute" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_compute" "', argument " "2"" of type '" "nupic::Real *""'"); 
  }
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_compute" "', argument " "3"" of type '" "nupic::Real *""'"); 
  }
  arg3 = reinterpret_cast< nupic::Real * >(argp3);
  ecode4 = SWIG_AsVal_bool(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Cells4_compute" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  ecode5 = SWIG_AsVal_bool(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Cells4_compute" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->compute(arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_reset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_reset" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reset();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_isActive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  nupic::algorithms::Cells4::CState *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx",(char *) "segIdx",(char *) "state", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Cells4_isActive",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_isActive" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_isActive" "', argument " "4"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_isActive" "', argument " "4"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg4 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Cells4 const *)arg1)->isActive(arg2,arg3,(nupic::algorithms::Cells4::CState const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getBestMatchingCellT(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::algorithms::Cells4::CState *arg3 = 0 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "state",(char *) "minThreshold", NULL 
  };
  std::pair< nupic::UInt,nupic::UInt > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Cells4_getBestMatchingCellT",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getBestMatchingCellT" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_getBestMatchingCellT" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getBestMatchingCellT" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->getBestMatchingCellT(arg2,(nupic::algorithms::Cells4::CState const &)*arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::pair<unsigned int,unsigned int > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getBestMatchingCellT1(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::algorithms::Cells4::CState *arg3 = 0 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "state",(char *) "minThreshold", NULL 
  };
  std::pair< nupic::UInt,nupic::UInt > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Cells4_getBestMatchingCellT1",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getBestMatchingCellT1" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_getBestMatchingCellT1" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_getBestMatchingCellT1" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->getBestMatchingCellT1(arg2,(nupic::algorithms::Cells4::CState const &)*arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::pair<unsigned int,unsigned int > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_computeForwardPropagation__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::algorithms::Cells4::CStateIndexed *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_computeForwardPropagation" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_computeForwardPropagation" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_computeForwardPropagation" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->computeForwardPropagation(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_computeForwardPropagation__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::algorithms::Cells4::CState *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_computeForwardPropagation" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_computeForwardPropagation" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_computeForwardPropagation" "', argument " "2"" of type '" "nupic::algorithms::Cells4::CState &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->computeForwardPropagation(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_computeForwardPropagation(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Cells4_computeForwardPropagation",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__CState, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Cells4_computeForwardPropagation__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Cells4_computeForwardPropagation__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Cells4_computeForwardPropagation'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::Cells4::computeForwardPropagation(nupic::algorithms::Cells4::CStateIndexed &)\n"
    "    nupic::algorithms::Cells4::Cells4::computeForwardPropagation(nupic::algorithms::Cells4::CState &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Cells4_updateInferenceState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_updateInferenceState",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_updateInferenceState" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_updateInferenceState" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_updateInferenceState" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateInferenceState((std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_inferPhase1(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeColumns",(char *) "useStartCells", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_inferPhase1",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_inferPhase1" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_inferPhase1" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_inferPhase1" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Cells4_inferPhase1" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->inferPhase1((std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_inferPhase2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_inferPhase2" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->inferPhase2();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_inferBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_inferBacktrack",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_inferBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_inferBacktrack" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_inferBacktrack" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->inferBacktrack((std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_updateLearningState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  nupic::Real *arg3 = (nupic::Real *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeColumns",(char *) "input", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_updateLearningState",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_updateLearningState" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_updateLearningState" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_updateLearningState" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg2 = ptr;
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_updateLearningState" "', argument " "3"" of type '" "nupic::Real *""'"); 
  }
  arg3 = reinterpret_cast< nupic::Real * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateLearningState((std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_learnPhase1(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg2 = 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activeColumns",(char *) "readOnly", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_learnPhase1",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_learnPhase1" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_learnPhase1" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_learnPhase1" "', argument " "2"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg2 = ptr;
  }
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Cells4_learnPhase1" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->learnPhase1((std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_learnPhase2(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "readOnly", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_learnPhase2",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_learnPhase2" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_learnPhase2" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->learnPhase2(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_learnBacktrack(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_learnBacktrack" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->learnBacktrack();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_learnBacktrackFrom(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "startOffset",(char *) "readOnly", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_learnBacktrackFrom",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_learnBacktrackFrom" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Cells4_learnBacktrackFrom" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->learnBacktrackFrom(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4__updateAvgLearnedSeqLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "prevSeqLength", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4__updateAvgLearnedSeqLength",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4__updateAvgLearnedSeqLength" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->_updateAvgLearnedSeqLength(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_chooseCellsToLearnFrom(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  nupic::UInt arg4 ;
  nupic::algorithms::Cells4::CStateIndexed *arg5 = 0 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx",(char *) "segIdx",(char *) "nSynToAdd",(char *) "state",(char *) "srcCells", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:Cells4_chooseCellsToLearnFrom",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_chooseCellsToLearnFrom" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed,  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_chooseCellsToLearnFrom" "', argument " "5"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  if (!argp5) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_chooseCellsToLearnFrom" "', argument " "5"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  arg5 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Cells4_chooseCellsToLearnFrom" "', argument " "6"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_chooseCellsToLearnFrom" "', argument " "6"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt,std::allocator< nupic::UInt > > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->chooseCellsToLearnFrom(arg2,arg3,arg4,*arg5,*arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getCellForNewSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_getCellForNewSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getCellForNewSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->getCellForNewSegment(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_computeUpdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  nupic::algorithms::Cells4::CStateIndexed *arg4 = 0 ;
  bool arg5 ;
  bool arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx",(char *) "segIdx",(char *) "activeState",(char *) "sequenceSegmentFlag",(char *) "newSynapsesFlag", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:Cells4_computeUpdate",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_computeUpdate" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_nupic__algorithms__Cells4__CStateIndexed,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_computeUpdate" "', argument " "4"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_computeUpdate" "', argument " "4"" of type '" "nupic::algorithms::Cells4::CStateIndexed &""'"); 
  }
  arg4 = reinterpret_cast< nupic::algorithms::Cells4::CStateIndexed * >(argp4);
  ecode5 = SWIG_AsVal_bool(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Cells4_computeUpdate" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  ecode6 = SWIG_AsVal_bool(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Cells4_computeUpdate" "', argument " "6"" of type '" "bool""'");
  } 
  arg6 = static_cast< bool >(val6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->computeUpdate(arg2,arg3,*arg4,arg5,arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_eraseOutSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dstCellIdx",(char *) "dstSegIdx",(char *) "srcCells", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Cells4_eraseOutSynapses",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_eraseOutSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res4 = swig::asptr(obj3, &ptr);
    if (!SWIG_IsOK(res4)) {
      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Cells4_eraseOutSynapses" "', argument " "4"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_eraseOutSynapses" "', argument " "4"" of type '" "std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &""'"); 
    }
    arg4 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->eraseOutSynapses(arg2,arg3,(std::vector< nupic::UInt,std::allocator< nupic::UInt > > const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_processSegmentUpdates(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Real *arg2 = (nupic::Real *) 0 ;
  nupic::algorithms::Cells4::CState *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "input",(char *) "predictedState", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_processSegmentUpdates",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_processSegmentUpdates" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_processSegmentUpdates" "', argument " "2"" of type '" "nupic::Real *""'"); 
  }
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__Cells4__CState,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Cells4_processSegmentUpdates" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_processSegmentUpdates" "', argument " "3"" of type '" "nupic::algorithms::Cells4::CState const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::Cells4::CState * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->processSegmentUpdates(arg2,(nupic::algorithms::Cells4::CState const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_cleanUpdatesList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cellIdx",(char *) "segIdx", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_cleanUpdatesList",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_cleanUpdatesList" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->cleanUpdatesList(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_applyGlobalDecay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_applyGlobalDecay" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->applyGlobalDecay();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_adaptSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::algorithms::Cells4::SegmentUpdate *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "update", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_adaptSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_adaptSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__Cells4__SegmentUpdate,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_adaptSegment" "', argument " "2"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_adaptSegment" "', argument " "2"" of type '" "nupic::algorithms::Cells4::SegmentUpdate const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::Cells4::SegmentUpdate * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->adaptSegment((nupic::algorithms::Cells4::SegmentUpdate const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_trimSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::Real arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "minPermanence",(char *) "minNumSyns", NULL 
  };
  std::pair< nupic::UInt,nupic::UInt > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_trimSegments",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_trimSegments" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->trimSegments(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::pair<unsigned int,unsigned int > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_persistentSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_persistentSize" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::Cells4::Cells4 const *)arg1)->persistentSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_saveToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::string arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "filePath", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_saveToFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_saveToFile" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Cells4_saveToFile" "', argument " "2"" of type '" "std::string""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cells4 const *)arg1)->saveToFile(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_loadFromFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::string arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "filePath", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_loadFromFile",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_loadFromFile" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    int res = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Cells4_loadFromFile" "', argument " "2"" of type '" "std::string""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->loadFromFile(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_save" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_save" "', argument " "2"" of type '" "std::ostream &""'"); 
  }
  arg2 = reinterpret_cast< std::ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cells4 const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_load" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_load" "', argument " "2"" of type '" "std::istream &""'"); 
  }
  arg2 = reinterpret_cast< std::istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setCellSegmentOrder(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "matchPythonOrder", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_setCellSegmentOrder",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setCellSegmentOrder" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_setCellSegmentOrder" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setCellSegmentOrder(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_addNewSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  bool arg4 ;
  std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > *arg5 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  int res5 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol",(char *) "sequenceSegmentFlag",(char *) "extSynapses", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:Cells4_addNewSegment",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_addNewSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  ecode4 = SWIG_AsVal_bool(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Cells4_addNewSegment" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  {
    std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *)0;
    res5 = swig::asptr(obj4, &ptr);
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_addNewSegment" "', argument " "5"" of type '" "std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_addNewSegment" "', argument " "5"" of type '" "std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &""'"); 
    }
    arg5 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->addNewSegment(arg2,arg3,arg4,(std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &)*arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res5)) delete arg5;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res5)) delete arg5;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_updateSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  nupic::UInt arg4 ;
  std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > *arg5 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res5 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol",(char *) "segIdx",(char *) "extSynapses", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:Cells4_updateSegment",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_updateSegment" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *ptr = (std::vector<std::pair< nupic::UInt32,nupic::UInt32 >,std::allocator< std::pair< nupic::UInt32,nupic::UInt32 > > > *)0;
    res5 = swig::asptr(obj4, &ptr);
    if (!SWIG_IsOK(res5)) {
      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Cells4_updateSegment" "', argument " "5"" of type '" "std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_updateSegment" "', argument " "5"" of type '" "std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &""'"); 
    }
    arg5 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateSegment(arg2,arg3,arg4,(std::vector< std::pair< nupic::UInt,nupic::UInt >,std::allocator< std::pair< nupic::UInt,nupic::UInt > > > const &)*arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res5)) delete arg5;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res5)) delete arg5;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4__rebalance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4__rebalance" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->_rebalance();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_rebuildOutSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_rebuildOutSynapses" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->rebuildOutSynapses();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_trimOldSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "age", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_trimOldSegments",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_trimOldSegments" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->trimOldSegments(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_printStates(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_printStates" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->printStates();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_printState(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt *arg2 = (nupic::UInt *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "state", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_printState",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_printState" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_printState" "', argument " "2"" of type '" "nupic::UInt *""'"); 
  }
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->printState(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_dumpPrevPatterns(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::deque< std::vector< nupic::UInt,std::allocator< nupic::UInt > > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "patterns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_dumpPrevPatterns",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_dumpPrevPatterns" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_dumpPrevPatterns" "', argument " "2"" of type '" "std::deque< std::vector< nupic::UInt,std::allocator< nupic::UInt > > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_dumpPrevPatterns" "', argument " "2"" of type '" "std::deque< std::vector< nupic::UInt,std::allocator< nupic::UInt > > > &""'"); 
  }
  arg2 = reinterpret_cast< std::deque< std::vector< nupic::UInt,std::allocator< nupic::UInt > > > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->dumpPrevPatterns(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_dumpSegmentUpdates(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_dumpSegmentUpdates" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->dumpSegmentUpdates();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getNonEmptySegList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "colIdx",(char *) "cellIdxInCol", NULL 
  };
  std::vector< nupic::UInt,std::allocator< nupic::UInt > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Cells4_getNonEmptySegList",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getNonEmptySegList" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->getNonEmptySegList(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_dumpTiming(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_dumpTiming" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->dumpTiming();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_resetTimers(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_resetTimers" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resetTimers();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_invariants(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  bool arg2 = (bool) false ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "verbose", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|O:Cells4_invariants",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_invariants" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  if (obj1) {
    ecode2 = SWIG_AsVal_bool(obj1, &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cells4_invariants" "', argument " "2"" of type '" "bool""'");
    } 
    arg2 = static_cast< bool >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::Cells4::Cells4 const *)arg1)->invariants(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_stats(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_stats" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::Cells4::Cells4 const *)arg1)->stats();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_loadFromString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inString", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Cells4_loadFromString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_loadFromString" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cells4_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Cells4_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_Cells4_Cells4_loadFromString(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4___getstate__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4___getstate__" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_Cells4_Cells4___getstate__(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setStatePointers__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  PyObject *arg5 = (PyObject *) 0 ;
  PyObject *arg6 = (PyObject *) 0 ;
  PyObject *arg7 = (PyObject *) 0 ;
  PyObject *arg8 = (PyObject *) 0 ;
  PyObject *arg9 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 9) || (nobjs > 9)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_setStatePointers" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  arg2 = swig_obj[1];
  arg3 = swig_obj[2];
  arg4 = swig_obj[3];
  arg5 = swig_obj[4];
  arg6 = swig_obj[5];
  arg7 = swig_obj[6];
  arg8 = swig_obj[7];
  arg9 = swig_obj[8];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_Cells4_Cells4_setStatePointers__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_setStatePointers(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[10];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Cells4_setStatePointers",0,9,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 9) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_AsCharPtrAndSize(argv[4], 0, NULL, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[5], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[6], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[7], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[8], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 9) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[3] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[4] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[5] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[6] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[7] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[8] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Cells4_setStatePointers__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Cells4_setStatePointers__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Cells4_setStatePointers'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::Cells4::setStatePointers(nupic::Byte *,nupic::Byte *,nupic::Byte *,nupic::Byte *,nupic::Real *,nupic::Real *,nupic::Real *,nupic::Real *)\n"
    "    nupic::algorithms::Cells4::Cells4::setStatePointers(PyObject *,PyObject *,PyObject *,PyObject *,PyObject *,PyObject *,PyObject *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Cells4_getStates(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getStates" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_Cells4_Cells4_getStates((nupic::algorithms::Cells4::Cells4 const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_getLearnStates(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_getLearnStates" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_Cells4_Cells4_getLearnStates((nupic::algorithms::Cells4::Cells4 const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_compute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::Cells4::Cells4 *arg1 = (nupic::algorithms::Cells4::Cells4 *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  bool arg3 ;
  bool arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject *result = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cells4_compute" "', argument " "1"" of type '" "nupic::algorithms::Cells4::Cells4 *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::Cells4::Cells4 * >(argp1);
  arg2 = swig_obj[1];
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Cells4_compute" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  ecode4 = SWIG_AsVal_bool(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Cells4_compute" "', argument " "4"" of type '" "bool""'");
  } 
  arg4 = static_cast< bool >(val4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_Cells4_Cells4_compute__SWIG_1(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Cells4_compute(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[6];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Cells4_compute",0,5,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 5) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Cells4_compute__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_Cells4_compute__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Cells4_compute'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::Cells4::Cells4::compute(nupic::Real *,nupic::Real *,bool,bool)\n"
    "    nupic::algorithms::Cells4::Cells4::compute(PyObject *,bool,bool)\n");
  return 0;
}


SWIGINTERN PyObject *Cells4_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__Cells4__Cells4, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_SpatialPooler__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::spatial_pooler::SpatialPooler *)new nupic::algorithms::spatial_pooler::SpatialPooler();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SpatialPooler__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::UInt > arg1 ;
  std::vector< nupic::UInt > arg2 ;
  nupic::UInt arg3 = (nupic::UInt) 16 ;
  nupic::Real arg4 = (nupic::Real) 0.5 ;
  bool arg5 = (bool) true ;
  nupic::Real arg6 = (nupic::Real) -1.0 ;
  nupic::UInt arg7 = (nupic::UInt) 10 ;
  nupic::UInt arg8 = (nupic::UInt) 0 ;
  nupic::Real arg9 = (nupic::Real) 0.01 ;
  nupic::Real arg10 = (nupic::Real) 0.1 ;
  nupic::Real arg11 = (nupic::Real) 0.1 ;
  nupic::Real arg12 = (nupic::Real) 0.001 ;
  nupic::Real arg13 = (nupic::Real) 0.001 ;
  nupic::UInt arg14 = (nupic::UInt) 1000 ;
  nupic::Real arg15 = (nupic::Real) 10.0 ;
  nupic::Int arg16 = (nupic::Int) 1 ;
  nupic::UInt arg17 = (nupic::UInt) 0 ;
  bool arg18 = (bool) true ;
  bool val5 ;
  int ecode5 = 0 ;
  int val16 ;
  int ecode16 = 0 ;
  bool val18 ;
  int ecode18 = 0 ;
  nupic::algorithms::spatial_pooler::SpatialPooler *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 18)) SWIG_fail;
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    int res = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_SpatialPooler" "', argument " "1"" of type '" "std::vector< nupic::UInt >""'"); 
    }
    arg1 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    int res = swig::asptr(swig_obj[1], &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "new_SpatialPooler" "', argument " "2"" of type '" "std::vector< nupic::UInt >""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  if (swig_obj[2]) {
    {
      arg3 = (nupic::UInt32) PyLong_AsLong(swig_obj[2]);
    }
  }
  if (swig_obj[3]) {
    {
      arg4 = (nupic::Real32) PyFloat_AsDouble(swig_obj[3]);
    }
  }
  if (swig_obj[4]) {
    ecode5 = SWIG_AsVal_bool(swig_obj[4], &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_SpatialPooler" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  if (swig_obj[5]) {
    {
      arg6 = (nupic::Real32) PyFloat_AsDouble(swig_obj[5]);
    }
  }
  if (swig_obj[6]) {
    {
      arg7 = (nupic::UInt32) PyLong_AsLong(swig_obj[6]);
    }
  }
  if (swig_obj[7]) {
    {
      arg8 = (nupic::UInt32) PyLong_AsLong(swig_obj[7]);
    }
  }
  if (swig_obj[8]) {
    {
      arg9 = (nupic::Real32) PyFloat_AsDouble(swig_obj[8]);
    }
  }
  if (swig_obj[9]) {
    {
      arg10 = (nupic::Real32) PyFloat_AsDouble(swig_obj[9]);
    }
  }
  if (swig_obj[10]) {
    {
      arg11 = (nupic::Real32) PyFloat_AsDouble(swig_obj[10]);
    }
  }
  if (swig_obj[11]) {
    {
      arg12 = (nupic::Real32) PyFloat_AsDouble(swig_obj[11]);
    }
  }
  if (swig_obj[12]) {
    {
      arg13 = (nupic::Real32) PyFloat_AsDouble(swig_obj[12]);
    }
  }
  if (swig_obj[13]) {
    {
      arg14 = (nupic::UInt32) PyLong_AsLong(swig_obj[13]);
    }
  }
  if (swig_obj[14]) {
    {
      arg15 = (nupic::Real32) PyFloat_AsDouble(swig_obj[14]);
    }
  }
  if (swig_obj[15]) {
    ecode16 = SWIG_AsVal_int(swig_obj[15], &val16);
    if (!SWIG_IsOK(ecode16)) {
      SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_SpatialPooler" "', argument " "16"" of type '" "nupic::Int""'");
    } 
    arg16 = static_cast< nupic::Int >(val16);
  }
  if (swig_obj[16]) {
    {
      arg17 = (nupic::UInt32) PyLong_AsLong(swig_obj[16]);
    }
  }
  if (swig_obj[17]) {
    ecode18 = SWIG_AsVal_bool(swig_obj[17], &val18);
    if (!SWIG_IsOK(ecode18)) {
      SWIG_exception_fail(SWIG_ArgError(ecode18), "in method '" "new_SpatialPooler" "', argument " "18"" of type '" "bool""'");
    } 
    arg18 = static_cast< bool >(val18);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::spatial_pooler::SpatialPooler *)new nupic::algorithms::spatial_pooler::SpatialPooler(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SpatialPooler(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[19];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_SpatialPooler",0,18,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if ((argc >= 2) && (argc <= 18)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<unsigned int,std::allocator< unsigned int > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[1], (std::vector<unsigned int,std::allocator< unsigned int > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 2) {
        {
          {
            int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
        if (argc > 3) {
          {
            {
              int res = SWIG_AsVal_float(argv[3], NULL);
              _v = SWIG_CheckState(res);
            }
          }
          if (!_v) goto check_2;
          _ranki += _v*_pi;
          _rankm += _pi;
          _pi *= SWIG_MAXCASTRANK;
          if (argc > 4) {
            {
              {
                int res = SWIG_AsVal_bool(argv[4], NULL);
                _v = SWIG_CheckState(res);
              }
            }
            if (!_v) goto check_2;
            _ranki += _v*_pi;
            _rankm += _pi;
            _pi *= SWIG_MAXCASTRANK;
            if (argc > 5) {
              {
                {
                  int res = SWIG_AsVal_float(argv[5], NULL);
                  _v = SWIG_CheckState(res);
                }
              }
              if (!_v) goto check_2;
              _ranki += _v*_pi;
              _rankm += _pi;
              _pi *= SWIG_MAXCASTRANK;
              if (argc > 6) {
                {
                  {
                    int res = SWIG_AsVal_unsigned_SS_int(argv[6], NULL);
                    _v = SWIG_CheckState(res);
                  }
                }
                if (!_v) goto check_2;
                _ranki += _v*_pi;
                _rankm += _pi;
                _pi *= SWIG_MAXCASTRANK;
                if (argc > 7) {
                  {
                    {
                      int res = SWIG_AsVal_unsigned_SS_int(argv[7], NULL);
                      _v = SWIG_CheckState(res);
                    }
                  }
                  if (!_v) goto check_2;
                  _ranki += _v*_pi;
                  _rankm += _pi;
                  _pi *= SWIG_MAXCASTRANK;
                  if (argc > 8) {
                    {
                      {
                        int res = SWIG_AsVal_float(argv[8], NULL);
                        _v = SWIG_CheckState(res);
                      }
                    }
                    if (!_v) goto check_2;
                    _ranki += _v*_pi;
                    _rankm += _pi;
                    _pi *= SWIG_MAXCASTRANK;
                    if (argc > 9) {
                      {
                        {
                          int res = SWIG_AsVal_float(argv[9], NULL);
                          _v = SWIG_CheckState(res);
                        }
                      }
                      if (!_v) goto check_2;
                      _ranki += _v*_pi;
                      _rankm += _pi;
                      _pi *= SWIG_MAXCASTRANK;
                      if (argc > 10) {
                        {
                          {
                            int res = SWIG_AsVal_float(argv[10], NULL);
                            _v = SWIG_CheckState(res);
                          }
                        }
                        if (!_v) goto check_2;
                        _ranki += _v*_pi;
                        _rankm += _pi;
                        _pi *= SWIG_MAXCASTRANK;
                        if (argc > 11) {
                          {
                            {
                              int res = SWIG_AsVal_float(argv[11], NULL);
                              _v = SWIG_CheckState(res);
                            }
                          }
                          if (!_v) goto check_2;
                          _ranki += _v*_pi;
                          _rankm += _pi;
                          _pi *= SWIG_MAXCASTRANK;
                          if (argc > 12) {
                            {
                              {
                                int res = SWIG_AsVal_float(argv[12], NULL);
                                _v = SWIG_CheckState(res);
                              }
                            }
                            if (!_v) goto check_2;
                            _ranki += _v*_pi;
                            _rankm += _pi;
                            _pi *= SWIG_MAXCASTRANK;
                            if (argc > 13) {
                              {
                                {
                                  int res = SWIG_AsVal_unsigned_SS_int(argv[13], NULL);
                                  _v = SWIG_CheckState(res);
                                }
                              }
                              if (!_v) goto check_2;
                              _ranki += _v*_pi;
                              _rankm += _pi;
                              _pi *= SWIG_MAXCASTRANK;
                              if (argc > 14) {
                                {
                                  {
                                    int res = SWIG_AsVal_float(argv[14], NULL);
                                    _v = SWIG_CheckState(res);
                                  }
                                }
                                if (!_v) goto check_2;
                                _ranki += _v*_pi;
                                _rankm += _pi;
                                _pi *= SWIG_MAXCASTRANK;
                                if (argc > 15) {
                                  {
                                    {
                                      int res = SWIG_AsVal_int(argv[15], NULL);
                                      _v = SWIG_CheckState(res);
                                    }
                                  }
                                  if (!_v) goto check_2;
                                  _ranki += _v*_pi;
                                  _rankm += _pi;
                                  _pi *= SWIG_MAXCASTRANK;
                                  if (argc > 16) {
                                    {
                                      {
                                        int res = SWIG_AsVal_unsigned_SS_int(argv[16], NULL);
                                        _v = SWIG_CheckState(res);
                                      }
                                    }
                                    if (!_v) goto check_2;
                                    _ranki += _v*_pi;
                                    _rankm += _pi;
                                    _pi *= SWIG_MAXCASTRANK;
                                    if (argc > 17) {
                                      {
                                        {
                                          int res = SWIG_AsVal_bool(argv[17], NULL);
                                          _v = SWIG_CheckState(res);
                                        }
                                      }
                                      if (!_v) goto check_2;
                                      _ranki += _v*_pi;
                                      _rankm += _pi;
                                      _pi *= SWIG_MAXCASTRANK;
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_SpatialPooler__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_SpatialPooler__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_SpatialPooler'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::SpatialPooler()\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::SpatialPooler(std::vector< nupic::UInt >,std::vector< nupic::UInt >,nupic::UInt,nupic::Real,bool,nupic::Real,nupic::UInt,nupic::UInt,nupic::Real,nupic::Real,nupic::Real,nupic::Real,nupic::Real,nupic::UInt,nupic::Real,nupic::Int,nupic::UInt,bool)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_SpatialPooler(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SpatialPooler" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_initialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > arg2 ;
  std::vector< nupic::UInt > arg3 ;
  nupic::UInt arg4 = (nupic::UInt) 16 ;
  nupic::Real arg5 = (nupic::Real) 0.5 ;
  bool arg6 = (bool) true ;
  nupic::Real arg7 = (nupic::Real) -1.0 ;
  nupic::UInt arg8 = (nupic::UInt) 10 ;
  nupic::UInt arg9 = (nupic::UInt) 0 ;
  nupic::Real arg10 = (nupic::Real) 0.01 ;
  nupic::Real arg11 = (nupic::Real) 0.1 ;
  nupic::Real arg12 = (nupic::Real) 0.1 ;
  nupic::Real arg13 = (nupic::Real) 0.001 ;
  nupic::Real arg14 = (nupic::Real) 0.001 ;
  nupic::UInt arg15 = (nupic::UInt) 1000 ;
  nupic::Real arg16 = (nupic::Real) 10.0 ;
  nupic::Int arg17 = (nupic::Int) 1 ;
  nupic::UInt arg18 = (nupic::UInt) 0 ;
  bool arg19 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  int val17 ;
  int ecode17 = 0 ;
  bool val19 ;
  int ecode19 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  PyObject * obj9 = 0 ;
  PyObject * obj10 = 0 ;
  PyObject * obj11 = 0 ;
  PyObject * obj12 = 0 ;
  PyObject * obj13 = 0 ;
  PyObject * obj14 = 0 ;
  PyObject * obj15 = 0 ;
  PyObject * obj16 = 0 ;
  PyObject * obj17 = 0 ;
  PyObject * obj18 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inputDimensions",(char *) "columnDimensions",(char *) "potentialRadius",(char *) "potentialPct",(char *) "globalInhibition",(char *) "localAreaDensity",(char *) "numActiveColumnsPerInhArea",(char *) "stimulusThreshold",(char *) "synPermInactiveDec",(char *) "synPermActiveInc",(char *) "synPermConnected",(char *) "minPctOverlapDutyCycles",(char *) "minPctActiveDutyCycles",(char *) "dutyCyclePeriod",(char *) "maxBoost",(char *) "seed",(char *) "spVerbosity",(char *) "wrapAround", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OOOOOOOOOOOOOOOO:SpatialPooler_initialize",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15,&obj16,&obj17,&obj18)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_initialize" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    int res = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "SpatialPooler_initialize" "', argument " "2"" of type '" "std::vector< nupic::UInt >""'"); 
    }
    arg2 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    int res = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "SpatialPooler_initialize" "', argument " "3"" of type '" "std::vector< nupic::UInt >""'"); 
    }
    arg3 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  if (obj3) {
    {
      arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
    }
  }
  if (obj4) {
    {
      arg5 = (nupic::Real32) PyFloat_AsDouble(obj4);
    }
  }
  if (obj5) {
    ecode6 = SWIG_AsVal_bool(obj5, &val6);
    if (!SWIG_IsOK(ecode6)) {
      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialPooler_initialize" "', argument " "6"" of type '" "bool""'");
    } 
    arg6 = static_cast< bool >(val6);
  }
  if (obj6) {
    {
      arg7 = (nupic::Real32) PyFloat_AsDouble(obj6);
    }
  }
  if (obj7) {
    {
      arg8 = (nupic::UInt32) PyLong_AsLong(obj7);
    }
  }
  if (obj8) {
    {
      arg9 = (nupic::UInt32) PyLong_AsLong(obj8);
    }
  }
  if (obj9) {
    {
      arg10 = (nupic::Real32) PyFloat_AsDouble(obj9);
    }
  }
  if (obj10) {
    {
      arg11 = (nupic::Real32) PyFloat_AsDouble(obj10);
    }
  }
  if (obj11) {
    {
      arg12 = (nupic::Real32) PyFloat_AsDouble(obj11);
    }
  }
  if (obj12) {
    {
      arg13 = (nupic::Real32) PyFloat_AsDouble(obj12);
    }
  }
  if (obj13) {
    {
      arg14 = (nupic::Real32) PyFloat_AsDouble(obj13);
    }
  }
  if (obj14) {
    {
      arg15 = (nupic::UInt32) PyLong_AsLong(obj14);
    }
  }
  if (obj15) {
    {
      arg16 = (nupic::Real32) PyFloat_AsDouble(obj15);
    }
  }
  if (obj16) {
    ecode17 = SWIG_AsVal_int(obj16, &val17);
    if (!SWIG_IsOK(ecode17)) {
      SWIG_exception_fail(SWIG_ArgError(ecode17), "in method '" "SpatialPooler_initialize" "', argument " "17"" of type '" "nupic::Int""'");
    } 
    arg17 = static_cast< nupic::Int >(val17);
  }
  if (obj17) {
    {
      arg18 = (nupic::UInt32) PyLong_AsLong(obj17);
    }
  }
  if (obj18) {
    ecode19 = SWIG_AsVal_bool(obj18, &val19);
    if (!SWIG_IsOK(ecode19)) {
      SWIG_exception_fail(SWIG_ArgError(ecode19), "in method '" "SpatialPooler_initialize" "', argument " "19"" of type '" "bool""'");
    } 
    arg19 = static_cast< bool >(val19);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->initialize(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_compute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  bool arg3 ;
  nupic::UInt *arg4 ;
  bool arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_compute" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_compute" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_compute" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialPooler_compute" "', argument " "4"" of type '" "nupic::UInt []""'"); 
  } 
  arg4 = reinterpret_cast< nupic::UInt * >(argp4);
  ecode5 = SWIG_AsVal_bool(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialPooler_compute" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->compute(arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_compute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  bool arg3 ;
  nupic::UInt *arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_compute" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_compute" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_compute" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialPooler_compute" "', argument " "4"" of type '" "nupic::UInt []""'"); 
  } 
  arg4 = reinterpret_cast< nupic::UInt * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->compute(arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_stripUnlearnedColumns__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_stripUnlearnedColumns" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_stripUnlearnedColumns" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->stripUnlearnedColumns(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_version" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->version();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_save" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_save" "', argument " "2"" of type '" "ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_save" "', argument " "2"" of type '" "ostream &""'"); 
  }
  arg2 = reinterpret_cast< ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_write" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  arg2 = reinterpret_cast< ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  SpatialPoolerProto::Builder *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_write" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SpatialPoolerProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_write" "', argument " "2"" of type '" "SpatialPoolerProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_write" "', argument " "2"" of type '" "SpatialPoolerProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< SpatialPoolerProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_load" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_load" "', argument " "2"" of type '" "istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_load" "', argument " "2"" of type '" "istream &""'"); 
  }
  arg2 = reinterpret_cast< istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_read" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  arg2 = reinterpret_cast< istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  SpatialPoolerProto::Reader *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_read" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_SpatialPoolerProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_read" "', argument " "2"" of type '" "SpatialPoolerProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_read" "', argument " "2"" of type '" "SpatialPoolerProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< SpatialPoolerProto::Reader * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_persistentSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_persistentSize" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->persistentSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getColumnDimensions(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::UInt > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getColumnDimensions" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getColumnDimensions();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getInputDimensions(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::UInt > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getInputDimensions" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getInputDimensions();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNumColumns(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNumColumns" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getNumColumns();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNumInputs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNumInputs" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getNumInputs();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPotentialRadius(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPotentialRadius" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getPotentialRadius();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPotentialRadius(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "potentialRadius", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setPotentialRadius",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPotentialRadius" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPotentialRadius(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPotentialPct(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPotentialPct" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getPotentialPct();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPotentialPct(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "potentialPct", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setPotentialPct",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPotentialPct" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPotentialPct(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getGlobalInhibition(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getGlobalInhibition" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getGlobalInhibition();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setGlobalInhibition(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "globalInhibition", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setGlobalInhibition",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setGlobalInhibition" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialPooler_setGlobalInhibition" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setGlobalInhibition(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNumActiveColumnsPerInhArea(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNumActiveColumnsPerInhArea" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Int)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getNumActiveColumnsPerInhArea();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_int(static_cast< int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setNumActiveColumnsPerInhArea(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "numActiveColumnsPerInhArea", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setNumActiveColumnsPerInhArea",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setNumActiveColumnsPerInhArea" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setNumActiveColumnsPerInhArea(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getLocalAreaDensity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getLocalAreaDensity" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getLocalAreaDensity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setLocalAreaDensity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "localAreaDensity", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setLocalAreaDensity",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setLocalAreaDensity" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setLocalAreaDensity(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getStimulusThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getStimulusThreshold" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getStimulusThreshold();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setStimulusThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "stimulusThreshold", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setStimulusThreshold",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setStimulusThreshold" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setStimulusThreshold(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getInhibitionRadius(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getInhibitionRadius" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getInhibitionRadius();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setInhibitionRadius(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inhibitionRadius", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setInhibitionRadius",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setInhibitionRadius" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setInhibitionRadius(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getDutyCyclePeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getDutyCyclePeriod" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getDutyCyclePeriod();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setDutyCyclePeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "dutyCyclePeriod", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setDutyCyclePeriod",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setDutyCyclePeriod" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setDutyCyclePeriod(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMaxBoost(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMaxBoost" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getMaxBoost();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMaxBoost(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "maxBoost", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setMaxBoost",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMaxBoost" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMaxBoost(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getIterationNum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getIterationNum" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getIterationNum();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setIterationNum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "iterationNum", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setIterationNum",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setIterationNum" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setIterationNum(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getIterationLearnNum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getIterationLearnNum" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getIterationLearnNum();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setIterationLearnNum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "iterationLearnNum", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setIterationLearnNum",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setIterationLearnNum" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setIterationLearnNum(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSpVerbosity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSpVerbosity" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSpVerbosity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSpVerbosity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "spVerbosity", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSpVerbosity",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSpVerbosity" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSpVerbosity(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getWrapAround(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getWrapAround" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getWrapAround();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setWrapAround(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "wrapAround", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setWrapAround",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setWrapAround" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialPooler_setWrapAround" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setWrapAround(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getUpdatePeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getUpdatePeriod" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getUpdatePeriod();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setUpdatePeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "updatePeriod", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setUpdatePeriod",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setUpdatePeriod" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setUpdatePeriod(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSynPermTrimThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSynPermTrimThreshold" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSynPermTrimThreshold();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSynPermTrimThreshold(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synPermTrimThreshold", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSynPermTrimThreshold",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSynPermTrimThreshold" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSynPermTrimThreshold(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSynPermActiveInc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSynPermActiveInc" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSynPermActiveInc();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSynPermActiveInc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synPermActiveInc", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSynPermActiveInc",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSynPermActiveInc" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSynPermActiveInc(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSynPermInactiveDec(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSynPermInactiveDec" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSynPermInactiveDec();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSynPermInactiveDec(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synPermInactiveDec", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSynPermInactiveDec",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSynPermInactiveDec" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSynPermInactiveDec(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSynPermBelowStimulusInc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSynPermBelowStimulusInc" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSynPermBelowStimulusInc();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSynPermBelowStimulusInc(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synPermBelowStimulusInc", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSynPermBelowStimulusInc",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSynPermBelowStimulusInc" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSynPermBelowStimulusInc(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getSynPermConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getSynPermConnected" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getSynPermConnected();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setSynPermConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "setSynPermConnected", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setSynPermConnected",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setSynPermConnected" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setSynPermConnected(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinPctOverlapDutyCycles(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinPctOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getMinPctOverlapDutyCycles();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinPctOverlapDutyCycles(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "minPctOverlapDutyCycles", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setMinPctOverlapDutyCycles",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinPctOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMinPctOverlapDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinPctActiveDutyCycles(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinPctActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getMinPctActiveDutyCycles();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinPctActiveDutyCycles(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "minPctActiveDutyCycles", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_setMinPctActiveDutyCycles",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinPctActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMinPctActiveDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getBoostFactors__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getBoostFactors" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getBoostFactors" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getBoostFactors(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setBoostFactors__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setBoostFactors" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_setBoostFactors" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setBoostFactors(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getOverlapDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getOverlapDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getOverlapDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setOverlapDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_setOverlapDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setOverlapDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getActiveDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getActiveDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getActiveDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setActiveDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_setActiveDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setActiveDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinOverlapDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getMinOverlapDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getMinOverlapDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinOverlapDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_setMinOverlapDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMinOverlapDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinActiveDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getMinActiveDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getMinActiveDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinActiveDutyCycles__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_setMinActiveDutyCycles" "', argument " "2"" of type '" "nupic::Real []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::Real * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setMinActiveDutyCycles(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPotential__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPotential" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getPotential" "', argument " "3"" of type '" "nupic::UInt []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::UInt * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getPotential(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPotential__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPotential" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_setPotential" "', argument " "3"" of type '" "nupic::UInt []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::UInt * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPotential(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPermanence__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::Real *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPermanence" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getPermanence" "', argument " "3"" of type '" "nupic::Real []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::Real * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getPermanence(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPermanence__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::Real *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPermanence" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_setPermanence" "', argument " "3"" of type '" "nupic::Real []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::Real * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->setPermanence(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedSynapses__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::UInt *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getConnectedSynapses" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getConnectedSynapses" "', argument " "3"" of type '" "nupic::UInt []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::UInt * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getConnectedSynapses(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedCounts__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getConnectedCounts" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_getConnectedCounts" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->getConnectedCounts(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_printParameters(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_printParameters" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1)->printParameters();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_toDense_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  nupic::UInt *arg3 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "sparse",(char *) "dense",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:SpatialPooler_toDense_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_toDense_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_toDense_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_toDense_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_toDense_" "', argument " "3"" of type '" "nupic::UInt []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::UInt * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->toDense_(*arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_boostOverlaps_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  std::vector< nupic::Real > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "boostedOverlaps", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_boostOverlaps_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_boostOverlaps_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_boostOverlaps_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_boostOverlaps_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_boostOverlaps_" "', argument " "3"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_boostOverlaps_" "', argument " "3"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::Real > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->boostOverlaps_(*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_range_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Int arg2 ;
  nupic::Int arg3 ;
  nupic::UInt arg4 ;
  bool arg5 ;
  std::vector< nupic::UInt > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "start",(char *) "end",(char *) "ubound",(char *) "wrapAround",(char *) "rangeVector", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:SpatialPooler_range_",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_range_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  ecode2 = SWIG_AsVal_int(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialPooler_range_" "', argument " "2"" of type '" "nupic::Int""'");
  } 
  arg2 = static_cast< nupic::Int >(val2);
  ecode3 = SWIG_AsVal_int(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_range_" "', argument " "3"" of type '" "nupic::Int""'");
  } 
  arg3 = static_cast< nupic::Int >(val3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_bool(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialPooler_range_" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "SpatialPooler_range_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_range_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->range_(arg2,arg3,arg4,arg5,*arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_mapColumn_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_mapColumn_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_mapColumn_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->mapColumn_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_mapPotential_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column",(char *) "wrapAround", NULL 
  };
  std::vector< nupic::UInt > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_mapPotential_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_mapPotential_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_mapPotential_" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->mapPotential_(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<unsigned int,std::allocator< unsigned int > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_initPermConnected_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_initPermConnected_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->initPermConnected_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_initPermNonConnected_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_initPermNonConnected_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->initPermNonConnected_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_initPermanence_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  nupic::Real arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "potential",(char *) "connectedPct", NULL 
  };
  std::vector< nupic::Real > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_initPermanence_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_initPermanence_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_initPermanence_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_initPermanence_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->initPermanence_(*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<float,std::allocator< float > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_clip_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  bool arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "perm",(char *) "trim", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_clip_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_clip_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_clip_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_clip_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  ecode3 = SWIG_AsVal_bool(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_clip_" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clip_(*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updatePermanencesForColumn_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  nupic::UInt arg3 ;
  bool arg4 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  bool val4 ;
  int ecode4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "perm",(char *) "column",(char *) "raisePerm", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:SpatialPooler_updatePermanencesForColumn_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updatePermanencesForColumn_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_updatePermanencesForColumn_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_updatePermanencesForColumn_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  if (obj3) {
    ecode4 = SWIG_AsVal_bool(obj3, &val4);
    if (!SWIG_IsOK(ecode4)) {
      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialPooler_updatePermanencesForColumn_" "', argument " "4"" of type '" "bool""'");
    } 
    arg4 = static_cast< bool >(val4);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updatePermanencesForColumn_(*arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_countConnected_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "perm", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_countConnected_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_countConnected_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_countConnected_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_countConnected_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->countConnected_(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_raisePermanencesToThreshold_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "perm",(char *) "potential", NULL 
  };
  nupic::UInt result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_raisePermanencesToThreshold_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_raisePermanencesToThreshold_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_raisePermanencesToThreshold_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_raisePermanencesToThreshold_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_raisePermanencesToThreshold_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_raisePermanencesToThreshold_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)(arg1)->raisePermanencesToThreshold_(*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_calculateOverlap_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inputVector",(char *) "overlap", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_calculateOverlap_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_calculateOverlap_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_calculateOverlap_" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_calculateOverlap_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_calculateOverlap_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->calculateOverlap_(arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_calculateOverlapPct_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  std::vector< nupic::Real > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "overlapPct", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_calculateOverlapPct_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_calculateOverlapPct_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_calculateOverlapPct_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_calculateOverlapPct_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_calculateOverlapPct_" "', argument " "3"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_calculateOverlapPct_" "', argument " "3"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::Real > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->calculateOverlapPct_(*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_isWinner_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::Real arg2 ;
  std::vector< std::pair< nupic::UInt,nupic::Real > > *arg3 = 0 ;
  nupic::UInt arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "score",(char *) "winners",(char *) "numWinners", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:SpatialPooler_isWinner_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_isWinner_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_isWinner_" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt,nupic::Real > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_isWinner_" "', argument " "3"" of type '" "std::vector< std::pair< nupic::UInt,nupic::Real > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< std::pair< nupic::UInt,nupic::Real > > * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->isWinner_(arg2,*arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_addToWinners_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  nupic::Real arg3 ;
  std::vector< std::pair< nupic::UInt,nupic::Real > > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "index",(char *) "score",(char *) "winners", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:SpatialPooler_addToWinners_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_addToWinners_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialPooler_addToWinners_" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt,nupic::Real > > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_addToWinners_" "', argument " "4"" of type '" "std::vector< std::pair< nupic::UInt,nupic::Real > > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< std::pair< nupic::UInt,nupic::Real > > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->addToWinners_(arg2,arg3,*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_inhibitColumns_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_inhibitColumns_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_inhibitColumns_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_inhibitColumns_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumns_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_inhibitColumns_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumns_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->inhibitColumns_(*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_inhibitColumnsGlobal_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  nupic::Real arg3 ;
  std::vector< nupic::UInt > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "density",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:SpatialPooler_inhibitColumnsGlobal_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_inhibitColumnsGlobal_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_inhibitColumnsGlobal_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumnsGlobal_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialPooler_inhibitColumnsGlobal_" "', argument " "4"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumnsGlobal_" "', argument " "4"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< nupic::UInt > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->inhibitColumnsGlobal_(*arg2,arg3,*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_inhibitColumnsLocal_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  nupic::Real arg3 ;
  std::vector< nupic::UInt > *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "density",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:SpatialPooler_inhibitColumnsLocal_",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_inhibitColumnsLocal_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_inhibitColumnsLocal_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumnsLocal_" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialPooler_inhibitColumnsLocal_" "', argument " "4"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_inhibitColumnsLocal_" "', argument " "4"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg4 = reinterpret_cast< std::vector< nupic::UInt > * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->inhibitColumnsLocal_(*arg2,arg3,*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNeighbors1D_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  nupic::UInt arg4 ;
  bool arg5 ;
  std::vector< nupic::UInt > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column",(char *) "dimensions",(char *) "radius",(char *) "wrapAround",(char *) "neighbors", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:SpatialPooler_getNeighbors1D_",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_bool(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighbors1D_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->getNeighbors1D_(arg2,*arg3,arg4,arg5,*arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNeighbors2D_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  nupic::UInt arg4 ;
  bool arg5 ;
  std::vector< nupic::UInt > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column",(char *) "dimensions",(char *) "radius",(char *) "wrapAround",(char *) "neighbors", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:SpatialPooler_getNeighbors2D_",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_bool(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighbors2D_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->getNeighbors2D_(arg2,*arg3,arg4,arg5,*arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_cartesianProduct_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< std::vector< nupic::UInt > > *arg2 = 0 ;
  std::vector< std::vector< nupic::UInt > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "vecs",(char *) "product", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_cartesianProduct_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_cartesianProduct_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_cartesianProduct_" "', argument " "2"" of type '" "std::vector< std::vector< nupic::UInt > > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_cartesianProduct_" "', argument " "2"" of type '" "std::vector< std::vector< nupic::UInt > > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< std::vector< nupic::UInt > > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_cartesianProduct_" "', argument " "3"" of type '" "std::vector< std::vector< nupic::UInt > > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_cartesianProduct_" "', argument " "3"" of type '" "std::vector< std::vector< nupic::UInt > > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< std::vector< nupic::UInt > > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->cartesianProduct_(*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getNeighborsND_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  nupic::UInt arg4 ;
  bool arg5 ;
  std::vector< nupic::UInt > *arg6 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  void *argp6 = 0 ;
  int res6 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column",(char *) "dimensions",(char *) "radius",(char *) "wrapAround",(char *) "neighbors", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOO:SpatialPooler_getNeighborsND_",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getNeighborsND_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_getNeighborsND_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighborsND_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_bool(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialPooler_getNeighborsND_" "', argument " "5"" of type '" "bool""'");
  } 
  arg5 = static_cast< bool >(val5);
  res6 = SWIG_ConvertPtr(obj5, &argp6, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res6)) {
    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "SpatialPooler_getNeighborsND_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp6) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_getNeighborsND_" "', argument " "6"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg6 = reinterpret_cast< std::vector< nupic::UInt > * >(argp6);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->getNeighborsND_(arg2,*arg3,arg4,arg5,*arg6);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_adaptSynapses_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt *arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inputVector",(char *) "activeColumns", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_adaptSynapses_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_adaptSynapses_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_adaptSynapses_" "', argument " "2"" of type '" "nupic::UInt []""'"); 
  } 
  arg2 = reinterpret_cast< nupic::UInt * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_adaptSynapses_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_adaptSynapses_" "', argument " "3"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg3 = reinterpret_cast< std::vector< nupic::UInt > * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->adaptSynapses_(arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_bumpUpWeakColumns_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_bumpUpWeakColumns_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->bumpUpWeakColumns_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateInhibitionRadius_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateInhibitionRadius_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateInhibitionRadius_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_avgColumnsPerInput_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::Real result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_avgColumnsPerInput_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->avgColumnsPerInput_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_avgConnectedSpanForColumn1D_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_avgConnectedSpanForColumn1D_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_avgConnectedSpanForColumn1D_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->avgConnectedSpanForColumn1D_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_avgConnectedSpanForColumn2D_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_avgConnectedSpanForColumn2D_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_avgConnectedSpanForColumn2D_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->avgConnectedSpanForColumn2D_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_avgConnectedSpanForColumnND_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "column", NULL 
  };
  nupic::Real result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_avgConnectedSpanForColumnND_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_avgConnectedSpanForColumnND_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::Real)(arg1)->avgConnectedSpanForColumnND_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateMinDutyCycles_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateMinDutyCycles_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateMinDutyCycles_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateMinDutyCyclesGlobal_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateMinDutyCyclesGlobal_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateMinDutyCyclesGlobal_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateMinDutyCyclesLocal_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateMinDutyCyclesLocal_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateMinDutyCyclesLocal_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateDutyCyclesHelper_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  std::vector< nupic::Real > *arg1 = 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  nupic::UInt arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "dutyCycles",(char *) "newValues",(char *) "period", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_updateDutyCyclesHelper_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateDutyCyclesHelper_" "', argument " "1"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp1) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_updateDutyCyclesHelper_" "', argument " "1"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg1 = reinterpret_cast< std::vector< nupic::Real > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_updateDutyCyclesHelper_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_updateDutyCyclesHelper_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  {
    arg3 = (nupic::UInt32) PyLong_AsLong(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic::algorithms::spatial_pooler::SpatialPooler::updateDutyCyclesHelper_(*arg1,*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateDutyCycles_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  nupic::UInt *arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "overlaps",(char *) "activeArray", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:SpatialPooler_updateDutyCycles_",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateDutyCycles_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_updateDutyCycles_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_updateDutyCycles_" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialPooler_updateDutyCycles_" "', argument " "3"" of type '" "nupic::UInt []""'"); 
  } 
  arg3 = reinterpret_cast< nupic::UInt * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateDutyCycles_(*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateBoostFactors_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateBoostFactors_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateBoostFactors_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_updateBookeepingVars_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "learn", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_updateBookeepingVars_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_updateBookeepingVars_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  ecode2 = SWIG_AsVal_bool(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialPooler_updateBookeepingVars_" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateBookeepingVars_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_isUpdateRound_(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_isUpdateRound_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)(arg1)->isUpdateRound_();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_seed_(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt64 arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "seed", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_seed_",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_seed_" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialPooler_seed_" "', argument " "2"" of type '" "nupic::UInt64""'");
  } 
  arg2 = static_cast< nupic::UInt64 >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->seed_(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_printState__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::UInt > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_printState" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_printState" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_printState" "', argument " "2"" of type '" "std::vector< nupic::UInt > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::UInt > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->printState(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_printState__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::vector< nupic::Real > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_printState" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_printState" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_printState" "', argument " "2"" of type '" "std::vector< nupic::Real > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::Real > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->printState(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_printState(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_printState",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_printState__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_printState__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_printState'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::printState(std::vector< nupic::UInt > &)\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::printState(std::vector< nupic::Real > &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_compute__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  bool arg3 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val3 ;
  int ecode3 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_compute" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialPooler_compute" "', argument " "3"" of type '" "bool""'");
  } 
  arg3 = static_cast< bool >(val3);
  arg4 = swig_obj[3];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_compute__SWIG_2(arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_compute(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[6];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_compute",0,5,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[3] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 5) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_bool(argv[4], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_compute__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_compute__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_SpatialPooler_compute__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_compute'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::compute(nupic::UInt [],bool,nupic::UInt [],bool)\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::compute(nupic::UInt [],bool,nupic::UInt [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::compute(PyObject *,bool,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_stripUnlearnedColumns__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_stripUnlearnedColumns" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_stripUnlearnedColumns__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_stripUnlearnedColumns(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_stripUnlearnedColumns",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_stripUnlearnedColumns__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_stripUnlearnedColumns__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_stripUnlearnedColumns'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::stripUnlearnedColumns(nupic::UInt []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::stripUnlearnedColumns(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_write__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_write" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_write__SWIG_2((nupic::algorithms::spatial_pooler::SpatialPooler const *)arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_write",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ostream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_SpatialPoolerProto__Builder, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_write__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_SpatialPooler_write__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::write(ostream &) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::write(SpatialPoolerProto::Builder &) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::write(PyObject *) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_read__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_read" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_read__SWIG_2(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_read",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_SpatialPoolerProto__Reader, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_read__SWIG_1(self, argc, argv);
    case 3:
      return _wrap_SpatialPooler_read__SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::read(istream &)\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::read(SpatialPoolerProto::Reader &)\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::read(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_loadFromString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inString", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:SpatialPooler_loadFromString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_loadFromString" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialPooler_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SpatialPooler_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_loadFromString(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getCState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getCState" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_spatial_pooler_SpatialPooler_getCState(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setBoostFactors__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setBoostFactors" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setBoostFactors__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setBoostFactors(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setBoostFactors",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setBoostFactors__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setBoostFactors__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setBoostFactors'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setBoostFactors(nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setBoostFactors(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getBoostFactors__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getBoostFactors" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getBoostFactors__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getBoostFactors(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getBoostFactors",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getBoostFactors__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getBoostFactors__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getBoostFactors'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getBoostFactors(nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getBoostFactors(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setOverlapDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setOverlapDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setOverlapDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setOverlapDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setOverlapDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setOverlapDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setOverlapDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setOverlapDutyCycles(nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setOverlapDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getOverlapDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getOverlapDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getOverlapDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getOverlapDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getOverlapDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getOverlapDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getOverlapDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getOverlapDutyCycles(nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getOverlapDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setActiveDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setActiveDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setActiveDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setActiveDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setActiveDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setActiveDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setActiveDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setActiveDutyCycles(nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setActiveDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getActiveDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getActiveDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getActiveDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getActiveDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getActiveDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getActiveDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getActiveDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getActiveDutyCycles(nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getActiveDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinOverlapDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setMinOverlapDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinOverlapDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setMinOverlapDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setMinOverlapDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setMinOverlapDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setMinOverlapDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setMinOverlapDutyCycles(nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setMinOverlapDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinOverlapDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinOverlapDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getMinOverlapDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinOverlapDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getMinOverlapDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getMinOverlapDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getMinOverlapDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getMinOverlapDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getMinOverlapDutyCycles(nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getMinOverlapDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinActiveDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setMinActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setMinActiveDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setMinActiveDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setMinActiveDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setMinActiveDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setMinActiveDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setMinActiveDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setMinActiveDutyCycles(nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setMinActiveDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinActiveDutyCycles__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getMinActiveDutyCycles" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getMinActiveDutyCycles__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getMinActiveDutyCycles(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getMinActiveDutyCycles",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getMinActiveDutyCycles__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getMinActiveDutyCycles__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getMinActiveDutyCycles'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getMinActiveDutyCycles(nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getMinActiveDutyCycles(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPotential__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPotential" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setPotential__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPotential(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setPotential",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setPotential__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setPotential__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setPotential'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setPotential(nupic::UInt,nupic::UInt [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setPotential(nupic::UInt,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPotential__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPotential" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getPotential__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPotential(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getPotential",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getPotential__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getPotential__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getPotential'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getPotential(nupic::UInt,nupic::UInt []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getPotential(nupic::UInt,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPermanence__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_setPermanence" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_setPermanence__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_setPermanence(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_setPermanence",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_setPermanence__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_setPermanence__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_setPermanence'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setPermanence(nupic::UInt,nupic::Real [])\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::setPermanence(nupic::UInt,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPermanence__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getPermanence" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getPermanence__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getPermanence(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getPermanence",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_float, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getPermanence__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getPermanence__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getPermanence'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getPermanence(nupic::UInt,nupic::Real []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getPermanence(nupic::UInt,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedSynapses__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  nupic::UInt arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getConnectedSynapses" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  arg3 = swig_obj[2];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getConnectedSynapses__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedSynapses(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getConnectedSynapses",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[2] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getConnectedSynapses__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getConnectedSynapses__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getConnectedSynapses'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getConnectedSynapses(nupic::UInt,nupic::UInt []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getConnectedSynapses(nupic::UInt,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedCounts__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::spatial_pooler::SpatialPooler *arg1 = (nupic::algorithms::spatial_pooler::SpatialPooler *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialPooler_getConnectedCounts" "', argument " "1"" of type '" "nupic::algorithms::spatial_pooler::SpatialPooler *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::spatial_pooler::SpatialPooler * >(argp1);
  arg2 = swig_obj[1];
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_spatial_pooler_SpatialPooler_getConnectedCounts__SWIG_1(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SpatialPooler_getConnectedCounts(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"SpatialPooler_getConnectedCounts",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_unsigned_int, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        _v = (argv[1] != 0);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_SpatialPooler_getConnectedCounts__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_SpatialPooler_getConnectedCounts__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SpatialPooler_getConnectedCounts'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getConnectedCounts(nupic::UInt []) const\n"
    "    nupic::algorithms::spatial_pooler::SpatialPooler::getConnectedCounts(PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *SpatialPooler_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__spatial_pooler__SpatialPooler, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN int Swig_var_Version_set(PyObject *) {
  SWIG_Error(SWIG_AttributeError,"Variable Version is read-only.");
  return 1;
}


SWIGINTERN PyObject *Swig_var_Version_get(void) {
  PyObject *pyobj = 0;
  
  pyobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::cla_classifier::Version));
  return pyobj;
}


SWIGINTERN PyObject *_wrap_new_FastCLAClassifier__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::cla_classifier::FastCLAClassifier *)new nupic::algorithms::cla_classifier::FastCLAClassifier();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FastCLAClassifier__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::UInt > *arg1 = 0 ;
  nupic::Real64 arg2 ;
  nupic::Real64 arg3 ;
  nupic::UInt arg4 ;
  int res1 = SWIG_OLDOBJ ;
  double val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  nupic::algorithms::cla_classifier::FastCLAClassifier *result = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FastCLAClassifier" "', argument " "1"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_FastCLAClassifier" "', argument " "1"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    arg1 = ptr;
  }
  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_FastCLAClassifier" "', argument " "2"" of type '" "nupic::Real64""'");
  } 
  arg2 = static_cast< nupic::Real64 >(val2);
  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_FastCLAClassifier" "', argument " "3"" of type '" "nupic::Real64""'");
  } 
  arg3 = static_cast< nupic::Real64 >(val3);
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(swig_obj[3]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::cla_classifier::FastCLAClassifier *)new nupic::algorithms::cla_classifier::FastCLAClassifier((std::vector< nupic::UInt > const &)*arg1,arg2,arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_FastCLAClassifier(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_FastCLAClassifier",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<unsigned int,std::allocator< unsigned int > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_double(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_double(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[3], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_FastCLAClassifier__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_FastCLAClassifier__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_FastCLAClassifier'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::FastCLAClassifier()\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::FastCLAClassifier(std::vector< nupic::UInt > const &,nupic::Real64,nupic::Real64,nupic::UInt)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_FastCLAClassifier(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_FastCLAClassifier" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_fastCompute(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  nupic::UInt arg4 ;
  nupic::Real64 arg5 ;
  bool arg6 ;
  bool arg7 ;
  bool arg8 ;
  nupic::algorithms::cla_classifier::ClassifierResult *arg9 = (nupic::algorithms::cla_classifier::ClassifierResult *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  double val5 ;
  int ecode5 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  bool val7 ;
  int ecode7 = 0 ;
  bool val8 ;
  int ecode8 = 0 ;
  void *argp9 = 0 ;
  int res9 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  PyObject * obj8 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "recordNum",(char *) "patternNZ",(char *) "bucketIdx",(char *) "actValue",(char *) "category",(char *) "learn",(char *) "infer",(char *) "result", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOOO:FastCLAClassifier_fastCompute",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_fastCompute" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FastCLAClassifier_fastCompute" "', argument " "3"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_fastCompute" "', argument " "3"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_double(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "FastCLAClassifier_fastCompute" "', argument " "5"" of type '" "nupic::Real64""'");
  } 
  arg5 = static_cast< nupic::Real64 >(val5);
  ecode6 = SWIG_AsVal_bool(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "FastCLAClassifier_fastCompute" "', argument " "6"" of type '" "bool""'");
  } 
  arg6 = static_cast< bool >(val6);
  ecode7 = SWIG_AsVal_bool(obj6, &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "FastCLAClassifier_fastCompute" "', argument " "7"" of type '" "bool""'");
  } 
  arg7 = static_cast< bool >(val7);
  ecode8 = SWIG_AsVal_bool(obj7, &val8);
  if (!SWIG_IsOK(ecode8)) {
    SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "FastCLAClassifier_fastCompute" "', argument " "8"" of type '" "bool""'");
  } 
  arg8 = static_cast< bool >(val8);
  res9 = SWIG_ConvertPtr(obj8, &argp9,SWIGTYPE_p_nupic__algorithms__cla_classifier__ClassifierResult, 0 |  0 );
  if (!SWIG_IsOK(res9)) {
    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "FastCLAClassifier_fastCompute" "', argument " "9"" of type '" "nupic::algorithms::cla_classifier::ClassifierResult *""'"); 
  }
  arg9 = reinterpret_cast< nupic::algorithms::cla_classifier::ClassifierResult * >(argp9);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->fastCompute(arg2,(std::vector< nupic::UInt > const &)*arg3,arg4,arg5,arg6,arg7,arg8,arg9);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_version" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->version();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_persistentSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_persistentSize" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->persistentSize();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "outStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FastCLAClassifier_save",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_save" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_save" "', argument " "2"" of type '" "ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_save" "', argument " "2"" of type '" "ostream &""'"); 
  }
  arg2 = reinterpret_cast< ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->save(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inStream", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FastCLAClassifier_load",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_load" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_load" "', argument " "2"" of type '" "istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_load" "', argument " "2"" of type '" "istream &""'"); 
  }
  arg2 = reinterpret_cast< istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->load(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  ClaClassifierProto::Builder *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_write" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ClaClassifierProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_write" "', argument " "2"" of type '" "ClaClassifierProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_write" "', argument " "2"" of type '" "ClaClassifierProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< ClaClassifierProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_write" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  arg2 = reinterpret_cast< ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FastCLAClassifier_write",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ClaClassifierProto__Builder, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ostream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_FastCLAClassifier_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FastCLAClassifier_write__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FastCLAClassifier_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::write(ClaClassifierProto::Builder &) const\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::write(ostream &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  ClaClassifierProto::Reader *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_read" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ClaClassifierProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_read" "', argument " "2"" of type '" "ClaClassifierProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_read" "', argument " "2"" of type '" "ClaClassifierProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< ClaClassifierProto::Reader * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_read" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  arg2 = reinterpret_cast< istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"FastCLAClassifier_read",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ClaClassifierProto__Reader, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_FastCLAClassifier_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_FastCLAClassifier_read__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'FastCLAClassifier_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::read(ClaClassifierProto::Reader &)\n"
    "    nupic::algorithms::cla_classifier::FastCLAClassifier::read(istream &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FastCLAClassifier___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier___eq__" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier___eq__" "', argument " "2"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier___eq__" "', argument " "2"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::cla_classifier::FastCLAClassifier const *)arg1)->operator ==((nupic::algorithms::cla_classifier::FastCLAClassifier const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_loadFromString(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  std::string *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "inString", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:FastCLAClassifier_loadFromString",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_loadFromString" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    std::string *ptr = (std::string *)0;
    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FastCLAClassifier_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_loadFromString" "', argument " "2"" of type '" "std::string const &""'"); 
    }
    arg2 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      nupic_algorithms_cla_classifier_FastCLAClassifier_loadFromString(arg1,(std::string const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_getCState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_getCState" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_cla_classifier_FastCLAClassifier_getCState(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_FastCLAClassifier_convertedCompute(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::cla_classifier::FastCLAClassifier *arg1 = (nupic::algorithms::cla_classifier::FastCLAClassifier *) 0 ;
  nupic::UInt arg2 ;
  std::vector< nupic::UInt > *arg3 = 0 ;
  nupic::UInt arg4 ;
  nupic::Real64 arg5 ;
  bool arg6 ;
  bool arg7 ;
  bool arg8 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  double val5 ;
  int ecode5 = 0 ;
  bool val6 ;
  int ecode6 = 0 ;
  bool val7 ;
  int ecode7 = 0 ;
  bool val8 ;
  int ecode8 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  PyObject * obj5 = 0 ;
  PyObject * obj6 = 0 ;
  PyObject * obj7 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "recordNum",(char *) "patternNZ",(char *) "bucketIdx",(char *) "actValue",(char *) "category",(char *) "learn",(char *) "infer", NULL 
  };
  PyObject *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOO:FastCLAClassifier_convertedCompute",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "1"" of type '" "nupic::algorithms::cla_classifier::FastCLAClassifier *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::cla_classifier::FastCLAClassifier * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  {
    std::vector<unsigned int,std::allocator< unsigned int > > *ptr = (std::vector<unsigned int,std::allocator< unsigned int > > *)0;
    res3 = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "3"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FastCLAClassifier_convertedCompute" "', argument " "3"" of type '" "std::vector< nupic::UInt > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    arg4 = (nupic::UInt32) PyLong_AsLong(obj3);
  }
  ecode5 = SWIG_AsVal_double(obj4, &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "5"" of type '" "nupic::Real64""'");
  } 
  arg5 = static_cast< nupic::Real64 >(val5);
  ecode6 = SWIG_AsVal_bool(obj5, &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "6"" of type '" "bool""'");
  } 
  arg6 = static_cast< bool >(val6);
  ecode7 = SWIG_AsVal_bool(obj6, &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "7"" of type '" "bool""'");
  } 
  arg7 = static_cast< bool >(val7);
  ecode8 = SWIG_AsVal_bool(obj7, &val8);
  if (!SWIG_IsOK(ecode8)) {
    SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "FastCLAClassifier_convertedCompute" "', argument " "8"" of type '" "bool""'");
  } 
  arg8 = static_cast< bool >(val8);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (PyObject *)nupic_algorithms_cla_classifier_FastCLAClassifier_convertedCompute(arg1,arg2,(std::vector< unsigned int > const &)*arg3,arg4,arg5,arg6,arg7,arg8);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = result;
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *FastCLAClassifier_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__cla_classifier__FastCLAClassifier, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  PyObject **arg2 = (PyObject **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  arg2 = &swig_obj[0];
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_iterator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)vector_Sl_nupic_algorithms_connections_Synapse_Sg__iterator(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___nonzero__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Synapse_Sg____nonzero__((vector< nupic::algorithms::connections::Synapse > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___bool__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Synapse_Sg____bool__((vector< nupic::algorithms::connections::Synapse > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___len__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Synapse_Sg____len__((vector< nupic::algorithms::connections::Synapse > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_pop" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = vector_Sl_nupic_algorithms_connections_Synapse_Sg__pop(arg1);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Synapse >::value_type(static_cast< const vector< nupic::algorithms::connections::Synapse >::value_type& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSynapseVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___getslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___getslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSynapseVector___getslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *)vector_Sl_nupic_algorithms_connections_Synapse_Sg____getslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg3 ;
  std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &arg4_defvalue = std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >() ;
  std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *arg4 = (std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:ConnectionsSynapseVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___setslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___setslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSynapseVector___setslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *ptr = (std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsSynapseVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____setslice__(arg1,arg2,arg3,(std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &)*arg4);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSynapseVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___delslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___delslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSynapseVector___delslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____delslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___delitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____delitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *)vector_Sl_nupic_algorithms_connections_Synapse_Sg____getitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *ptr = (std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____delitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector___delitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::__delitem__(vector< nupic::algorithms::connections::Synapse >::difference_type)\n"
    "    vector< nupic::algorithms::connections::Synapse >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___getitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (vector< nupic::algorithms::connections::Synapse >::value_type *) &vector_Sl_nupic_algorithms_connections_Synapse_Sg____getitem____SWIG_1((vector< nupic::algorithms::connections::Synapse > const *)arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector___getitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::__getitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Synapse >::__getitem__(vector< nupic::algorithms::connections::Synapse >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::difference_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Synapse_Sg____setitem____SWIG_2(arg1,arg2,(nupic::algorithms::connections::Synapse const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector___setitem__",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_ConnectionsSynapseVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::__setitem__(PySliceObject *,std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > const &)\n"
    "    vector< nupic::algorithms::connections::Synapse >::__setitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Synapse >::__setitem__(vector< nupic::algorithms::connections::Synapse >::difference_type,vector< nupic::algorithms::connections::Synapse >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSynapseVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_append" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSynapseVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Synapse_Sg__append(arg1,(nupic::algorithms::connections::Synapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapseVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse > *)new vector< nupic::algorithms::connections::Synapse >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapseVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::algorithms::connections::Synapse > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  vector< nupic::algorithms::connections::Synapse > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *ptr = (std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ConnectionsSynapseVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Synapse > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSynapseVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Synapse > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse > *)new vector< nupic::algorithms::connections::Synapse >((std::vector< nupic::algorithms::connections::Synapse > const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_empty" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((vector< nupic::algorithms::connections::Synapse > const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_size" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Synapse > const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_clear" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  std::vector< nupic::algorithms::connections::Synapse > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSynapseVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_swap" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSynapseVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Synapse > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Synapse > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::connections::Synapse > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< nupic::algorithms::connections::Synapse > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_get_allocator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Synapse > const *)arg1)->get_allocator();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Synapse >::allocator_type(static_cast< const vector< nupic::algorithms::connections::Synapse >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Synapse_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_begin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_end" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_rbegin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rbegin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_rend" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rend();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapseVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  vector< nupic::algorithms::connections::Synapse > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSynapseVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse > *)new vector< nupic::algorithms::connections::Synapse >(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_pop_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  vector< nupic::algorithms::connections::Synapse >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Synapse_Sg__erase__SWIG_0(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::iterator arg2 ;
  vector< nupic::algorithms::connections::Synapse >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  vector< nupic::algorithms::connections::Synapse >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res3) || !iter3) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Synapse_Sg__erase__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector_erase",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::erase(vector< nupic::algorithms::connections::Synapse >::iterator)\n"
    "    vector< nupic::algorithms::connections::Synapse >::erase(vector< nupic::algorithms::connections::Synapse >::iterator,vector< nupic::algorithms::connections::Synapse >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapseVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse >::size_type arg1 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  vector< nupic::algorithms::connections::Synapse > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSynapseVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ConnectionsSynapseVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSynapseVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse > *)new vector< nupic::algorithms::connections::Synapse >(arg1,(vector< nupic::algorithms::connections::Synapse >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapseVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsSynapseVector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsSynapseVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsSynapseVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_ConnectionsSynapseVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_ConnectionsSynapseVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsSynapseVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::vector()\n"
    "    vector< nupic::algorithms::connections::Synapse >::vector(std::vector< nupic::algorithms::connections::Synapse > const &)\n"
    "    vector< nupic::algorithms::connections::Synapse >::vector(vector< nupic::algorithms::connections::Synapse >::size_type)\n"
    "    vector< nupic::algorithms::connections::Synapse >::vector(vector< nupic::algorithms::connections::Synapse >::size_type,vector< nupic::algorithms::connections::Synapse >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSynapseVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_push_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSynapseVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((vector< nupic::algorithms::connections::Synapse >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_front" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse >::value_type *) &((vector< nupic::algorithms::connections::Synapse > const *)arg1)->front();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Synapse >::value_type *) &((vector< nupic::algorithms::connections::Synapse > const *)arg1)->back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::size_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSynapseVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_assign" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector_assign" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSynapseVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(vector< nupic::algorithms::connections::Synapse >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::size_type arg2 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSynapseVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(vector< nupic::algorithms::connections::Synapse >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector_resize",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::resize(vector< nupic::algorithms::connections::Synapse >::size_type)\n"
    "    vector< nupic::algorithms::connections::Synapse >::resize(vector< nupic::algorithms::connections::Synapse >::size_type,vector< nupic::algorithms::connections::Synapse >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::iterator arg2 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  vector< nupic::algorithms::connections::Synapse >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSynapseVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Synapse_Sg__insert__SWIG_0(arg1,arg2,(nupic::algorithms::connections::Synapse const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Synapse >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::iterator arg2 ;
  vector< nupic::algorithms::connections::Synapse >::size_type arg3 ;
  vector< nupic::algorithms::connections::Synapse >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSynapseVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSynapseVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsSynapseVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapseVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Synapse >::value_type const &""'"); 
  }
  arg4 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Synapse_Sg__insert__SWIG_1(arg1,arg2,arg3,(nupic::algorithms::connections::Synapse const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSynapseVector_insert",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Synapse >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSynapseVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSynapseVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSynapseVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Synapse >::insert(vector< nupic::algorithms::connections::Synapse >::iterator,vector< nupic::algorithms::connections::Synapse >::value_type const &)\n"
    "    vector< nupic::algorithms::connections::Synapse >::insert(vector< nupic::algorithms::connections::Synapse >::iterator,vector< nupic::algorithms::connections::Synapse >::size_type,vector< nupic::algorithms::connections::Synapse >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  vector< nupic::algorithms::connections::Synapse >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSynapseVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_reserve" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapseVector_reserve" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Synapse >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Synapse >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reserve(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapseVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Synapse >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapseVector_capacity" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Synapse > const *)arg1)->capacity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsSynapseVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Synapse > *arg1 = (vector< nupic::algorithms::connections::Synapse > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsSynapseVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Synapse > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Synapse > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsSynapseVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  PyObject **arg2 = (PyObject **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  arg2 = &swig_obj[0];
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_iterator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)vector_Sl_nupic_algorithms_connections_Segment_Sg__iterator(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___nonzero__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Segment_Sg____nonzero__((vector< nupic::algorithms::connections::Segment > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___bool__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Segment_Sg____bool__((vector< nupic::algorithms::connections::Segment > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___len__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Segment_Sg____len__((vector< nupic::algorithms::connections::Segment > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_pop" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = vector_Sl_nupic_algorithms_connections_Segment_Sg__pop(arg1);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Segment >::value_type(static_cast< const vector< nupic::algorithms::connections::Segment >::value_type& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSegmentVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___getslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___getslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSegmentVector___getslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *)vector_Sl_nupic_algorithms_connections_Segment_Sg____getslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg3 ;
  std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &arg4_defvalue = std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >() ;
  std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *arg4 = (std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:ConnectionsSegmentVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___setslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___setslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSegmentVector___setslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *ptr = (std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsSegmentVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____setslice__(arg1,arg2,arg3,(std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &)*arg4);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSegmentVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___delslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___delslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSegmentVector___delslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____delslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___delitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____delitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *)vector_Sl_nupic_algorithms_connections_Segment_Sg____getitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *ptr = (std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____delitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector___delitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::__delitem__(vector< nupic::algorithms::connections::Segment >::difference_type)\n"
    "    vector< nupic::algorithms::connections::Segment >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  vector< nupic::algorithms::connections::Segment >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___getitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (vector< nupic::algorithms::connections::Segment >::value_type *) &vector_Sl_nupic_algorithms_connections_Segment_Sg____getitem____SWIG_1((vector< nupic::algorithms::connections::Segment > const *)arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector___getitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::__getitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Segment >::__getitem__(vector< nupic::algorithms::connections::Segment >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::difference_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Segment_Sg____setitem____SWIG_2(arg1,arg2,(nupic::algorithms::connections::Segment const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector___setitem__",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_ConnectionsSegmentVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::__setitem__(PySliceObject *,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > const &)\n"
    "    vector< nupic::algorithms::connections::Segment >::__setitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Segment >::__setitem__(vector< nupic::algorithms::connections::Segment >::difference_type,vector< nupic::algorithms::connections::Segment >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegmentVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_append" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegmentVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Segment_Sg__append(arg1,(nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegmentVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment > *)new vector< nupic::algorithms::connections::Segment >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegmentVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::algorithms::connections::Segment > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  vector< nupic::algorithms::connections::Segment > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *ptr = (std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ConnectionsSegmentVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Segment > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSegmentVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Segment > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment > *)new vector< nupic::algorithms::connections::Segment >((std::vector< nupic::algorithms::connections::Segment > const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_empty" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((vector< nupic::algorithms::connections::Segment > const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_size" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Segment > const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_clear" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  std::vector< nupic::algorithms::connections::Segment > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegmentVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_swap" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegmentVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Segment > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Segment > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::connections::Segment > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< nupic::algorithms::connections::Segment > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_get_allocator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Segment > const *)arg1)->get_allocator();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Segment >::allocator_type(static_cast< const vector< nupic::algorithms::connections::Segment >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Segment_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_begin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_end" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_rbegin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rbegin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_rend" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rend();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegmentVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  vector< nupic::algorithms::connections::Segment > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSegmentVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment > *)new vector< nupic::algorithms::connections::Segment >(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_pop_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  vector< nupic::algorithms::connections::Segment >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Segment_Sg__erase__SWIG_0(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::iterator arg2 ;
  vector< nupic::algorithms::connections::Segment >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  vector< nupic::algorithms::connections::Segment >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res3) || !iter3) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Segment_Sg__erase__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector_erase",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::erase(vector< nupic::algorithms::connections::Segment >::iterator)\n"
    "    vector< nupic::algorithms::connections::Segment >::erase(vector< nupic::algorithms::connections::Segment >::iterator,vector< nupic::algorithms::connections::Segment >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegmentVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment >::size_type arg1 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  vector< nupic::algorithms::connections::Segment > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSegmentVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ConnectionsSegmentVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSegmentVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment > *)new vector< nupic::algorithms::connections::Segment >(arg1,(vector< nupic::algorithms::connections::Segment >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegmentVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsSegmentVector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsSegmentVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsSegmentVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_ConnectionsSegmentVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_ConnectionsSegmentVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsSegmentVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::vector()\n"
    "    vector< nupic::algorithms::connections::Segment >::vector(std::vector< nupic::algorithms::connections::Segment > const &)\n"
    "    vector< nupic::algorithms::connections::Segment >::vector(vector< nupic::algorithms::connections::Segment >::size_type)\n"
    "    vector< nupic::algorithms::connections::Segment >::vector(vector< nupic::algorithms::connections::Segment >::size_type,vector< nupic::algorithms::connections::Segment >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegmentVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_push_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegmentVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((vector< nupic::algorithms::connections::Segment >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_front" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment >::value_type *) &((vector< nupic::algorithms::connections::Segment > const *)arg1)->front();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Segment >::value_type *) &((vector< nupic::algorithms::connections::Segment > const *)arg1)->back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::size_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsSegmentVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_assign" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector_assign" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSegmentVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(vector< nupic::algorithms::connections::Segment >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::size_type arg2 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSegmentVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(vector< nupic::algorithms::connections::Segment >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector_resize",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::resize(vector< nupic::algorithms::connections::Segment >::size_type)\n"
    "    vector< nupic::algorithms::connections::Segment >::resize(vector< nupic::algorithms::connections::Segment >::size_type,vector< nupic::algorithms::connections::Segment >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::iterator arg2 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  vector< nupic::algorithms::connections::Segment >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsSegmentVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Segment_Sg__insert__SWIG_0(arg1,arg2,(nupic::algorithms::connections::Segment const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Segment >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::iterator arg2 ;
  vector< nupic::algorithms::connections::Segment >::size_type arg3 ;
  vector< nupic::algorithms::connections::Segment >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsSegmentVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsSegmentVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsSegmentVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegmentVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Segment >::value_type const &""'"); 
  }
  arg4 = reinterpret_cast< vector< nupic::algorithms::connections::Segment >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Segment_Sg__insert__SWIG_1(arg1,arg2,arg3,(nupic::algorithms::connections::Segment const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsSegmentVector_insert",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Segment >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsSegmentVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsSegmentVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsSegmentVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Segment >::insert(vector< nupic::algorithms::connections::Segment >::iterator,vector< nupic::algorithms::connections::Segment >::value_type const &)\n"
    "    vector< nupic::algorithms::connections::Segment >::insert(vector< nupic::algorithms::connections::Segment >::iterator,vector< nupic::algorithms::connections::Segment >::size_type,vector< nupic::algorithms::connections::Segment >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  vector< nupic::algorithms::connections::Segment >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegmentVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_reserve" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegmentVector_reserve" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Segment >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Segment >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reserve(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegmentVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Segment >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegmentVector_capacity" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Segment > const *)arg1)->capacity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsSegmentVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Segment > *arg1 = (vector< nupic::algorithms::connections::Segment > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsSegmentVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Segment > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Segment > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsSegmentVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsCellVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  PyObject **arg2 = (PyObject **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  swig::SwigPyIterator *result = 0 ;
  
  arg2 = &swig_obj[0];
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_iterator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (swig::SwigPyIterator *)vector_Sl_nupic_algorithms_connections_Cell_Sg__iterator(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___nonzero__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Cell_Sg____nonzero__((vector< nupic::algorithms::connections::Cell > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___bool__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)vector_Sl_nupic_algorithms_connections_Cell_Sg____bool__((vector< nupic::algorithms::connections::Cell > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___len__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Cell_Sg____len__((vector< nupic::algorithms::connections::Cell > const *)arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::value_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_pop" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = vector_Sl_nupic_algorithms_connections_Cell_Sg__pop(arg1);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Cell >::value_type(static_cast< const vector< nupic::algorithms::connections::Cell >::value_type& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Cell, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *result = 0 ;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsCellVector___getslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___getslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___getslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsCellVector___getslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)vector_Sl_nupic_algorithms_connections_Cell_Sg____getslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg3 ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &arg4_defvalue = std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >() ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *arg4 = (std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *) &arg4_defvalue ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  int res4 = SWIG_OLDOBJ ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:ConnectionsCellVector___setslice__",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___setslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___setslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsCellVector___setslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val3);
  if (obj3) {
    {
      std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
      res4 = swig::asptr(obj3, &ptr);
      if (!SWIG_IsOK(res4)) {
        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsCellVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
      }
      if (!ptr) {
        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector___setslice__" "', argument " "4"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
      }
      arg4 = ptr;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____setslice__(arg1,arg2,arg3,(std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &)*arg4);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res4)) delete arg4;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res4)) delete arg4;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  ptrdiff_t val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "i",(char *) "j", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsCellVector___delslice__",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___delslice__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___delslice__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsCellVector___delslice__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____delslice__(arg1,arg2,arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___delitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____delitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)vector_Sl_nupic_algorithms_connections_Cell_Sg____getitem____SWIG_0(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res3 = SWIG_OLDOBJ ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
    res3 = swig::asptr(swig_obj[2], &ptr);
    if (!SWIG_IsOK(res3)) {
      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsCellVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector___setitem__" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    arg3 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  if (SWIG_IsNewObj(res3)) delete arg3;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res3)) delete arg3;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  PySliceObject *arg2 = (PySliceObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___delitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    if (!PySlice_Check(swig_obj[1])) {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
    }
    arg2 = (PySliceObject *) swig_obj[1];
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____delitem____SWIG_1(arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      catch(std::invalid_argument &_e) {
        SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___delitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector___delitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector___delitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector___delitem____SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector___delitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::__delitem__(vector< nupic::algorithms::connections::Cell >::difference_type)\n"
    "    vector< nupic::algorithms::connections::Cell >::__delitem__(PySliceObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  vector< nupic::algorithms::connections::Cell >::value_type *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___getitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___getitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        result = (vector< nupic::algorithms::connections::Cell >::value_type *) &vector_Sl_nupic_algorithms_connections_Cell_Sg____getitem____SWIG_1((vector< nupic::algorithms::connections::Cell > const *)arg1,arg2);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___getitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector___getitem__",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector___getitem____SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector___getitem____SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector___getitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::__getitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Cell >::__getitem__(vector< nupic::algorithms::connections::Cell >::difference_type) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::difference_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ptrdiff_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector___setitem__" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector___setitem__" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::difference_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::difference_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsCellVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector___setitem__" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      try {
        vector_Sl_nupic_algorithms_connections_Cell_Sg____setitem____SWIG_2(arg1,arg2,(nupic::algorithms::connections::Cell const &)*arg3);
      }
      catch(std::out_of_range &_e) {
        SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
      }
      
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector___setitem__(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector___setitem__",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          _v = PySlice_Check(argv[1]);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = swig::asptr(argv[2], (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector___setitem____SWIG_1(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector___setitem____SWIG_0(self, argc, argv);
    case 3:
      return _wrap_ConnectionsCellVector___setitem____SWIG_2(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector___setitem__'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::__setitem__(PySliceObject *,std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &)\n"
    "    vector< nupic::algorithms::connections::Cell >::__setitem__(PySliceObject *)\n"
    "    vector< nupic::algorithms::connections::Cell >::__setitem__(vector< nupic::algorithms::connections::Cell >::difference_type,vector< nupic::algorithms::connections::Cell >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCellVector_append",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_append" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCellVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_append" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Cell_Sg__append(arg1,(nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCellVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell > *)new vector< nupic::algorithms::connections::Cell >();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCellVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  std::vector< nupic::algorithms::connections::Cell > *arg1 = 0 ;
  int res1 = SWIG_OLDOBJ ;
  vector< nupic::algorithms::connections::Cell > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
    res1 = swig::asptr(swig_obj[0], &ptr);
    if (!SWIG_IsOK(res1)) {
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ConnectionsCellVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Cell > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsCellVector" "', argument " "1"" of type '" "std::vector< nupic::algorithms::connections::Cell > const &""'"); 
    }
    arg1 = ptr;
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell > *)new vector< nupic::algorithms::connections::Cell >((std::vector< nupic::algorithms::connections::Cell > const &)*arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_NEW |  0 );
  if (SWIG_IsNewObj(res1)) delete arg1;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res1)) delete arg1;
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_empty" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((vector< nupic::algorithms::connections::Cell > const *)arg1)->empty();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_size" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Cell > const *)arg1)->size();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_clear" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->clear();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  std::vector< nupic::algorithms::connections::Cell > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "v", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCellVector_swap",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_swap" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCellVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell > &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_swap" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell > &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::connections::Cell > * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->swap(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SwigValueWrapper< std::allocator< nupic::algorithms::connections::Cell > > result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_get_allocator" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Cell > const *)arg1)->get_allocator();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new vector< nupic::algorithms::connections::Cell >::allocator_type(static_cast< const vector< nupic::algorithms::connections::Cell >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_nupic__algorithms__connections__Cell_t, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_begin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->begin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_end" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->end();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_rbegin" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rbegin();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::reverse_iterator result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_rend" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->rend();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::reverse_iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCellVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell >::size_type arg1 ;
  size_t val1 ;
  int ecode1 = 0 ;
  vector< nupic::algorithms::connections::Cell > *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsCellVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell > *)new vector< nupic::algorithms::connections::Cell >(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_pop_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->pop_back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::iterator arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  vector< nupic::algorithms::connections::Cell >::iterator result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Cell_Sg__erase__SWIG_0(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::iterator arg2 ;
  vector< nupic::algorithms::connections::Cell >::iterator arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  swig::SwigPyIterator *iter3 = 0 ;
  int res3 ;
  vector< nupic::algorithms::connections::Cell >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_erase" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res3) || !iter3) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter3);
    if (iter_t) {
      arg3 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_erase" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Cell_Sg__erase__SWIG_1(arg1,arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_erase(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector_erase",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector_erase__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector_erase__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector_erase'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::erase(vector< nupic::algorithms::connections::Cell >::iterator)\n"
    "    vector< nupic::algorithms::connections::Cell >::erase(vector< nupic::algorithms::connections::Cell >::iterator,vector< nupic::algorithms::connections::Cell >::iterator)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCellVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell >::size_type arg1 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg2 = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  vector< nupic::algorithms::connections::Cell > *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsCellVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg1 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ConnectionsCellVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsCellVector" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell > *)new vector< nupic::algorithms::connections::Cell >(arg1,(vector< nupic::algorithms::connections::Cell >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCellVector(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsCellVector",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        int res = swig::asptr(argv[0], (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >**)(0));
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_3;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 3;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_3:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_size_t(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_4;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 4;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_4:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsCellVector__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsCellVector__SWIG_2(self, argc, argv);
    case 3:
      return _wrap_new_ConnectionsCellVector__SWIG_1(self, argc, argv);
    case 4:
      return _wrap_new_ConnectionsCellVector__SWIG_3(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsCellVector'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::vector()\n"
    "    vector< nupic::algorithms::connections::Cell >::vector(std::vector< nupic::algorithms::connections::Cell > const &)\n"
    "    vector< nupic::algorithms::connections::Cell >::vector(vector< nupic::algorithms::connections::Cell >::size_type)\n"
    "    vector< nupic::algorithms::connections::Cell >::vector(vector< nupic::algorithms::connections::Cell >::size_type,vector< nupic::algorithms::connections::Cell >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCellVector_push_back",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_push_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCellVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_push_back" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg2 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->push_back((vector< nupic::algorithms::connections::Cell >::value_type const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_front" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell >::value_type *) &((vector< nupic::algorithms::connections::Cell > const *)arg1)->front();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::value_type *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_back" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (vector< nupic::algorithms::connections::Cell >::value_type *) &((vector< nupic::algorithms::connections::Cell > const *)arg1)->back();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::size_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n",(char *) "x", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ConnectionsCellVector_assign",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_assign" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector_assign" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsCellVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_assign" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->assign(arg2,(vector< nupic::algorithms::connections::Cell >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::size_type arg2 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_resize" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector_resize" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsCellVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_resize" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->resize(arg2,(vector< nupic::algorithms::connections::Cell >::value_type const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_resize(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[4];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector_resize",0,3,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[1], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector_resize__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector_resize__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector_resize'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::resize(vector< nupic::algorithms::connections::Cell >::size_type)\n"
    "    vector< nupic::algorithms::connections::Cell >::resize(vector< nupic::algorithms::connections::Cell >::size_type,vector< nupic::algorithms::connections::Cell >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::iterator arg2 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  vector< nupic::algorithms::connections::Cell >::iterator result;
  
  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
    }
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ConnectionsCellVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg3 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = vector_Sl_nupic_algorithms_connections_Cell_Sg__insert__SWIG_0(arg1,arg2,(nupic::algorithms::connections::Cell const &)*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const vector< nupic::algorithms::connections::Cell >::iterator & >(result)),
    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::iterator arg2 ;
  vector< nupic::algorithms::connections::Cell >::size_type arg3 ;
  vector< nupic::algorithms::connections::Cell >::value_type *arg4 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  swig::SwigPyIterator *iter2 = 0 ;
  int res2 ;
  size_t val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  
  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_insert" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
  if (!SWIG_IsOK(res2) || !iter2) {
    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
  } else {
    swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter2);
    if (iter_t) {
      arg2 = iter_t->get_current();
    } else {
      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ConnectionsCellVector_insert" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::iterator""'");
    }
  }
  ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ConnectionsCellVector_insert" "', argument " "3"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg3 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ConnectionsCellVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  if (!argp4) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCellVector_insert" "', argument " "4"" of type '" "vector< nupic::algorithms::connections::Cell >::value_type const &""'"); 
  }
  arg4 = reinterpret_cast< vector< nupic::algorithms::connections::Cell >::value_type * >(argp4);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      vector_Sl_nupic_algorithms_connections_Cell_Sg__insert__SWIG_1(arg1,arg2,arg3,(nupic::algorithms::connections::Cell const &)*arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_insert(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[5];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"ConnectionsCellVector_insert",0,4,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 3) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 4) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        swig::SwigPyIterator *iter = 0;
        int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<vector< nupic::algorithms::connections::Cell >::iterator > *>(iter) != 0));
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        {
          int res = SWIG_AsVal_size_t(argv[2], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_ConnectionsCellVector_insert__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_ConnectionsCellVector_insert__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ConnectionsCellVector_insert'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    vector< nupic::algorithms::connections::Cell >::insert(vector< nupic::algorithms::connections::Cell >::iterator,vector< nupic::algorithms::connections::Cell >::value_type const &)\n"
    "    vector< nupic::algorithms::connections::Cell >::insert(vector< nupic::algorithms::connections::Cell >::iterator,vector< nupic::algorithms::connections::Cell >::size_type,vector< nupic::algorithms::connections::Cell >::value_type const &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  vector< nupic::algorithms::connections::Cell >::size_type arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "n", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCellVector_reserve",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_reserve" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsCellVector_reserve" "', argument " "2"" of type '" "vector< nupic::algorithms::connections::Cell >::size_type""'");
  } 
  arg2 = static_cast< vector< nupic::algorithms::connections::Cell >::size_type >(val2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->reserve(arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCellVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  vector< nupic::algorithms::connections::Cell >::size_type result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCellVector_capacity" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > const *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((vector< nupic::algorithms::connections::Cell > const *)arg1)->capacity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsCellVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  vector< nupic::algorithms::connections::Cell > *arg1 = (vector< nupic::algorithms::connections::Cell > *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsCellVector" "', argument " "1"" of type '" "vector< nupic::algorithms::connections::Cell > *""'"); 
  }
  arg1 = reinterpret_cast< vector< nupic::algorithms::connections::Cell > * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsCellVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsCell_idx_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::CellIdx arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"ConnectionsCell_idx_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell_idx_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(swig_obj[1]);
  }
  if (arg1) (arg1)->idx = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell_idx_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::CellIdx result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell_idx_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  result = (nupic::algorithms::connections::CellIdx) ((arg1)->idx);
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCell__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellIdx arg1 ;
  nupic::algorithms::connections::Cell *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Cell *)new nupic::algorithms::connections::Cell(arg1);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCell__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Cell *)new nupic::algorithms::connections::Cell();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsCell(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[2];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsCell",0,1,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 1) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsCell__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsCell__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsCell'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Cell::Cell(nupic::algorithms::connections::CellIdx)\n"
    "    nupic::algorithms::connections::Cell::Cell()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCell___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell___eq__" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCell___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCell___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Cell const *)arg1)->operator ==((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell___le__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCell___le__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell___le__" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCell___le__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCell___le__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Cell const *)arg1)->operator <=((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell___lt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCell___lt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell___lt__" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCell___lt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCell___lt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Cell const *)arg1)->operator <((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell___ge__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCell___ge__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell___ge__" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCell___ge__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCell___ge__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Cell const *)arg1)->operator >=((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsCell___gt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsCell___gt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsCell___gt__" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsCell___gt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsCell___gt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Cell const *)arg1)->operator >((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Cell *arg1 = (nupic::algorithms::connections::Cell *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Cell, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsCell" "', argument " "1"" of type '" "nupic::algorithms::connections::Cell *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsCell_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__Cell, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsSegment_idx_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::SegmentIdx arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned char val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"ConnectionsSegment_idx_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment_idx_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_char(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSegment_idx_set" "', argument " "2"" of type '" "nupic::algorithms::connections::SegmentIdx""'");
  } 
  arg2 = static_cast< nupic::algorithms::connections::SegmentIdx >(val2);
  if (arg1) (arg1)->idx = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment_idx_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::SegmentIdx result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment_idx_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  result = (nupic::algorithms::connections::SegmentIdx) ((arg1)->idx);
  resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment_cell_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"ConnectionsSegment_cell_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment_cell_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment_cell_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment_cell_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  if (arg1) (arg1)->cell = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment_cell_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::Cell *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment_cell_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  result = (nupic::algorithms::connections::Cell *) & ((arg1)->cell);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegment__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentIdx arg1 ;
  nupic::algorithms::connections::Cell arg2 ;
  unsigned char val1 ;
  int ecode1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  nupic::algorithms::connections::Segment *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_char(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentIdx""'");
  } 
  arg1 = static_cast< nupic::algorithms::connections::SegmentIdx >(val1);
  {
    res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ConnectionsSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell""'"); 
    }  
    if (!argp2) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell""'");
    } else {
      nupic::algorithms::connections::Cell * temp = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
      arg2 = *temp;
      if (SWIG_IsNewObj(res2)) delete temp;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Segment *)new nupic::algorithms::connections::Segment(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegment__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Segment *)new nupic::algorithms::connections::Segment();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSegment(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsSegment",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_char(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__algorithms__connections__Cell, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsSegment__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsSegment__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsSegment'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Segment::Segment(nupic::algorithms::connections::SegmentIdx,nupic::algorithms::connections::Cell)\n"
    "    nupic::algorithms::connections::Segment::Segment()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegment___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment___eq__" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Segment const *)arg1)->operator ==((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment___le__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegment___le__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment___le__" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment___le__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment___le__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Segment const *)arg1)->operator <=((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment___lt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegment___lt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment___lt__" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment___lt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment___lt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Segment const *)arg1)->operator <((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment___ge__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegment___ge__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment___ge__" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment___ge__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment___ge__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Segment const *)arg1)->operator >=((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSegment___gt__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSegment___gt__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSegment___gt__" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSegment___gt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSegment___gt__" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Segment const *)arg1)->operator >((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Segment *arg1 = (nupic::algorithms::connections::Segment *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Segment *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsSegment_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_ConnectionsSynapse_idx_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  nupic::algorithms::connections::SynapseIdx arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned char val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"ConnectionsSynapse_idx_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapse_idx_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_char(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ConnectionsSynapse_idx_set" "', argument " "2"" of type '" "nupic::algorithms::connections::SynapseIdx""'");
  } 
  arg2 = static_cast< nupic::algorithms::connections::SynapseIdx >(val2);
  if (arg1) (arg1)->idx = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapse_idx_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::SynapseIdx result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapse_idx_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  result = (nupic::algorithms::connections::SynapseIdx) ((arg1)->idx);
  resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapse_segment_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"ConnectionsSynapse_segment_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapse_segment_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSynapse_segment_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapse_segment_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  if (arg1) (arg1)->segment = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapse_segment_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::Segment *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapse_segment_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  result = (nupic::algorithms::connections::Segment *) & ((arg1)->segment);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Segment, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapse__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseIdx arg1 ;
  nupic::algorithms::connections::Segment arg2 ;
  unsigned char val1 ;
  int ecode1 = 0 ;
  void *argp2 ;
  int res2 = 0 ;
  nupic::algorithms::connections::Synapse *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_char(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ConnectionsSynapse" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseIdx""'");
  } 
  arg1 = static_cast< nupic::algorithms::connections::SynapseIdx >(val1);
  {
    res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ConnectionsSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment""'"); 
    }  
    if (!argp2) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ConnectionsSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment""'");
    } else {
      nupic::algorithms::connections::Segment * temp = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
      arg2 = *temp;
      if (SWIG_IsNewObj(res2)) delete temp;
    }
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Synapse *)new nupic::algorithms::connections::Synapse(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapse__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Synapse *)new nupic::algorithms::connections::Synapse();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_ConnectionsSynapse(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_ConnectionsSynapse",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_char(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_nupic__algorithms__connections__Segment, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_ConnectionsSynapse__SWIG_1(self, argc, argv);
    case 2:
      return _wrap_new_ConnectionsSynapse__SWIG_0(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ConnectionsSynapse'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Synapse::Synapse(nupic::algorithms::connections::SynapseIdx,nupic::algorithms::connections::Segment)\n"
    "    nupic::algorithms::connections::Synapse::Synapse()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_ConnectionsSynapse___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  nupic::algorithms::connections::Synapse *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ConnectionsSynapse___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ConnectionsSynapse___eq__" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ConnectionsSynapse___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ConnectionsSynapse___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Synapse const *)arg1)->operator ==((nupic::algorithms::connections::Synapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_ConnectionsSynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Synapse *arg1 = (nupic::algorithms::connections::Synapse *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ConnectionsSynapse" "', argument " "1"" of type '" "nupic::algorithms::connections::Synapse *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *ConnectionsSynapse_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_SynapseData_presynapticCell_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SynapseData_presynapticCell_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_presynapticCell_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SynapseData_presynapticCell_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SynapseData_presynapticCell_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  if (arg1) (arg1)->presynapticCell = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SynapseData_presynapticCell_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::Cell *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_presynapticCell_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  result = (nupic::algorithms::connections::Cell *) & ((arg1)->presynapticCell);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Cell, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SynapseData_permanence_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  nupic::algorithms::connections::Permanence arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SynapseData_permanence_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_permanence_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  {
    arg2 = (nupic::Real32) PyFloat_AsDouble(swig_obj[1]);
  }
  if (arg1) (arg1)->permanence = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SynapseData_permanence_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::Permanence result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_permanence_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  result = (nupic::algorithms::connections::Permanence) ((arg1)->permanence);
  resultobj = SWIG_From_float(static_cast< float >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SynapseData_destroyed_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SynapseData_destroyed_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_destroyed_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SynapseData_destroyed_set" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (arg1) (arg1)->destroyed = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SynapseData_destroyed_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SynapseData_destroyed_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  result = (bool) ((arg1)->destroyed);
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SynapseData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_SynapseData",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::SynapseData *)new nupic::algorithms::connections::SynapseData();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__SynapseData, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_SynapseData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SynapseData *arg1 = (nupic::algorithms::connections::SynapseData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SynapseData, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SynapseData" "', argument " "1"" of type '" "nupic::algorithms::connections::SynapseData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SynapseData * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *SynapseData_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__SynapseData, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_SegmentData_synapses_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SegmentData_synapses_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_synapses_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SegmentData_synapses_set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SegmentData_synapses_set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > * >(argp2);
  if (arg1) (arg1)->synapses = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentData_synapses_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_synapses_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  result = (std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > *) & ((arg1)->synapses);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentData_destroyed_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SegmentData_destroyed_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_destroyed_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SegmentData_destroyed_set" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  if (arg1) (arg1)->destroyed = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentData_destroyed_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  bool result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_destroyed_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  result = (bool) ((arg1)->destroyed);
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentData_lastUsedIteration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  nupic::algorithms::connections::Iteration arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"SegmentData_lastUsedIteration_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_lastUsedIteration_set" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SegmentData_lastUsedIteration_set" "', argument " "2"" of type '" "nupic::algorithms::connections::Iteration""'");
  } 
  arg2 = static_cast< nupic::algorithms::connections::Iteration >(val2);
  if (arg1) (arg1)->lastUsedIteration = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_SegmentData_lastUsedIteration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::algorithms::connections::Iteration result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SegmentData_lastUsedIteration_get" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  result = (nupic::algorithms::connections::Iteration) ((arg1)->lastUsedIteration);
  resultobj = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_SegmentData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_SegmentData",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::SegmentData *)new nupic::algorithms::connections::SegmentData();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__SegmentData, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_SegmentData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::SegmentData *arg1 = (nupic::algorithms::connections::SegmentData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__SegmentData, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SegmentData" "', argument " "1"" of type '" "nupic::algorithms::connections::SegmentData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::SegmentData * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *SegmentData_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__SegmentData, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_CellData_segments_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellData *arg1 = (nupic::algorithms::connections::CellData *) 0 ;
  std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"CellData_segments_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__CellData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CellData_segments_set" "', argument " "1"" of type '" "nupic::algorithms::connections::CellData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::CellData * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CellData_segments_set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CellData_segments_set" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > * >(argp2);
  if (arg1) (arg1)->segments = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_CellData_segments_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellData *arg1 = (nupic::algorithms::connections::CellData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__CellData, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CellData_segments_get" "', argument " "1"" of type '" "nupic::algorithms::connections::CellData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::CellData * >(argp1);
  result = (std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > *) & ((arg1)->segments);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_CellData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellData *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_CellData",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::CellData *)new nupic::algorithms::connections::CellData();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__CellData, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_CellData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellData *arg1 = (nupic::algorithms::connections::CellData *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__CellData, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CellData" "', argument " "1"" of type '" "nupic::algorithms::connections::CellData *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::CellData * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *CellData_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__CellData, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_Activity_activeSegmentsForCell_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *arg1 = (nupic::algorithms::connections::Activity *) 0 ;
  std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Activity_activeSegmentsForCell_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Activity, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Activity_activeSegmentsForCell_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Activity *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Activity_activeSegmentsForCell_set" "', argument " "2"" of type '" "std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Activity_activeSegmentsForCell_set" "', argument " "2"" of type '" "std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > * >(argp2);
  if (arg1) (arg1)->activeSegmentsForCell = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Activity_activeSegmentsForCell_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *arg1 = (nupic::algorithms::connections::Activity *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Activity, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Activity_activeSegmentsForCell_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Activity *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp1);
  result = (std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > *) & ((arg1)->activeSegmentsForCell);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Activity_numActiveSynapsesForSegment_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *arg1 = (nupic::algorithms::connections::Activity *) 0 ;
  std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args,"Activity_numActiveSynapsesForSegment_set",2,2,swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Activity, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Activity_numActiveSynapsesForSegment_set" "', argument " "1"" of type '" "nupic::algorithms::connections::Activity *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Activity_numActiveSynapsesForSegment_set" "', argument " "2"" of type '" "std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Activity_numActiveSynapsesForSegment_set" "', argument " "2"" of type '" "std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > const &""'"); 
  }
  arg2 = reinterpret_cast< std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > * >(argp2);
  if (arg1) (arg1)->numActiveSynapsesForSegment = *arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Activity_numActiveSynapsesForSegment_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *arg1 = (nupic::algorithms::connections::Activity *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Activity, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Activity_numActiveSynapsesForSegment_get" "', argument " "1"" of type '" "nupic::algorithms::connections::Activity *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp1);
  result = (std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > *) & ((arg1)->numActiveSynapsesForSegment);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Activity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args,"new_Activity",0,0,0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Activity *)new nupic::algorithms::connections::Activity();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Activity, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_delete_Activity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Activity *arg1 = (nupic::algorithms::connections::Activity *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Activity, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Activity" "', argument " "1"" of type '" "nupic::algorithms::connections::Activity *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Activity_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__Activity, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

SWIGINTERN PyObject *_wrap_new_Connections__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Connections *)new nupic::algorithms::connections::Connections();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Connections, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Connections__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::CellIdx arg1 ;
  nupic::algorithms::connections::SegmentIdx arg2 = (nupic::algorithms::connections::SegmentIdx) (UCHAR_MAX-1) ;
  unsigned char val2 ;
  int ecode2 = 0 ;
  nupic::algorithms::connections::Connections *result = 0 ;
  
  if ((nobjs < 1) || (nobjs > 2)) SWIG_fail;
  {
    arg1 = (nupic::UInt32) PyLong_AsLong(swig_obj[0]);
  }
  if (swig_obj[1]) {
    ecode2 = SWIG_AsVal_unsigned_SS_char(swig_obj[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Connections" "', argument " "2"" of type '" "nupic::algorithms::connections::SegmentIdx""'");
    } 
    arg2 = static_cast< nupic::algorithms::connections::SegmentIdx >(val2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::algorithms::connections::Connections *)new nupic::algorithms::connections::Connections(arg1,arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nupic__algorithms__connections__Connections, SWIG_POINTER_NEW |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_new_Connections(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"new_Connections",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 0) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
    if ((argc >= 1) && (argc <= 2)) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        {
          int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
          _v = SWIG_CheckState(res);
        }
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (argc > 1) {
        {
          {
            int res = SWIG_AsVal_unsigned_SS_char(argv[1], NULL);
            _v = SWIG_CheckState(res);
          }
        }
        if (!_v) goto check_2;
        _ranki += _v*_pi;
        _rankm += _pi;
        _pi *= SWIG_MAXCASTRANK;
      }
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_new_Connections__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_new_Connections__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Connections'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Connections::Connections()\n"
    "    nupic::algorithms::connections::Connections::Connections(nupic::algorithms::connections::CellIdx,nupic::algorithms::connections::SegmentIdx)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_delete_Connections(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Connections" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      delete arg1;
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_initialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::CellIdx arg2 ;
  nupic::algorithms::connections::SegmentIdx arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned char val3 ;
  int ecode3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "numCells",(char *) "maxSegmentsPerCell", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Connections_initialize",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_initialize" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    arg2 = (nupic::UInt32) PyLong_AsLong(obj1);
  }
  ecode3 = SWIG_AsVal_unsigned_SS_char(obj2, &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Connections_initialize" "', argument " "3"" of type '" "nupic::algorithms::connections::SegmentIdx""'");
  } 
  arg3 = static_cast< nupic::algorithms::connections::SegmentIdx >(val3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->initialize(arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_createSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cell", NULL 
  };
  nupic::algorithms::connections::Segment result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_createSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_createSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_createSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_createSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->createSegment((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::connections::Segment(static_cast< const nupic::algorithms::connections::Segment& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Segment, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_createSynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  nupic::algorithms::connections::Cell *arg3 = 0 ;
  nupic::algorithms::connections::Permanence arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segment",(char *) "presynapticCell",(char *) "permanence", NULL 
  };
  nupic::algorithms::connections::Synapse result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Connections_createSynapse",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_createSynapse" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_createSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_createSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Connections_createSynapse" "', argument " "3"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_createSynapse" "', argument " "3"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp3);
  {
    arg4 = (nupic::Real32) PyFloat_AsDouble(obj3);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->createSynapse((nupic::algorithms::connections::Segment const &)*arg2,(nupic::algorithms::connections::Cell const &)*arg3,arg4);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::connections::Synapse(static_cast< const nupic::algorithms::connections::Synapse& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Synapse, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_destroySegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segment", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_destroySegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_destroySegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_destroySegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_destroySegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->destroySegment((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_destroySynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Synapse *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synapse", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_destroySynapse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_destroySynapse" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_destroySynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_destroySynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->destroySynapse((nupic::algorithms::connections::Synapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_updateSynapsePermanence(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Synapse *arg2 = 0 ;
  nupic::algorithms::connections::Permanence arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synapse",(char *) "permanence", NULL 
  };
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Connections_updateSynapsePermanence",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_updateSynapsePermanence" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_updateSynapsePermanence" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_updateSynapsePermanence" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp2);
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->updateSynapsePermanence((nupic::algorithms::connections::Synapse const &)*arg2,arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_segmentsForCell(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cell", NULL 
  };
  SwigValueWrapper< std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_segmentsForCell",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_segmentsForCell" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_segmentsForCell" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_segmentsForCell" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::connections::Connections const *)arg1)->segmentsForCell((nupic::algorithms::connections::Cell const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_synapsesForSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segment", NULL 
  };
  SwigValueWrapper< std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_synapsesForSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_synapsesForSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_synapsesForSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_synapsesForSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->synapsesForSegment((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_dataForSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Segment *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "segment", NULL 
  };
  nupic::algorithms::connections::SegmentData result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_dataForSegment",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_dataForSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_dataForSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_dataForSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Segment const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::connections::Connections const *)arg1)->dataForSegment((nupic::algorithms::connections::Segment const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::connections::SegmentData(static_cast< const nupic::algorithms::connections::SegmentData& >(result))), SWIGTYPE_p_nupic__algorithms__connections__SegmentData, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_dataForSynapse(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Synapse *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "synapse", NULL 
  };
  nupic::algorithms::connections::SynapseData result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_dataForSynapse",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_dataForSynapse" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Synapse,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_dataForSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_dataForSynapse" "', argument " "2"" of type '" "nupic::algorithms::connections::Synapse const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Synapse * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = ((nupic::algorithms::connections::Connections const *)arg1)->dataForSynapse((nupic::algorithms::connections::Synapse const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::connections::SynapseData(static_cast< const nupic::algorithms::connections::SynapseData& >(result))), SWIGTYPE_p_nupic__algorithms__connections__SynapseData, SWIG_POINTER_OWN |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_mostActiveSegmentForCells(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *arg2 = 0 ;
  SwigValueWrapper< std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > > arg3 ;
  nupic::algorithms::connections::SynapseIdx arg4 ;
  nupic::algorithms::connections::Segment *arg5 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned char val4 ;
  int ecode4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cells",(char *) "input",(char *) "synapseThreshold",(char *) "retSegment", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOO:Connections_mostActiveSegmentForCells",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_mostActiveSegmentForCells" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_mostActiveSegmentForCells" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_mostActiveSegmentForCells" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
    int res = swig::asptr(obj2, &ptr);
    if (!SWIG_IsOK(res) || !ptr) {
      SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Connections_mostActiveSegmentForCells" "', argument " "3"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >""'"); 
    }
    arg3 = *ptr;
    if (SWIG_IsNewObj(res)) delete ptr;
  }
  ecode4 = SWIG_AsVal_unsigned_SS_char(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Connections_mostActiveSegmentForCells" "', argument " "4"" of type '" "nupic::algorithms::connections::SynapseIdx""'");
  } 
  arg4 = static_cast< nupic::algorithms::connections::SynapseIdx >(val4);
  res5 = SWIG_ConvertPtr(obj4, &argp5, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Connections_mostActiveSegmentForCells" "', argument " "5"" of type '" "nupic::algorithms::connections::Segment &""'"); 
  }
  if (!argp5) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_mostActiveSegmentForCells" "', argument " "5"" of type '" "nupic::algorithms::connections::Segment &""'"); 
  }
  arg5 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp5);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Connections const *)arg1)->mostActiveSegmentForCells((std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &)*arg2,arg3,arg4,*arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_leastRecentlyUsedSegment(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Cell *arg2 = 0 ;
  nupic::algorithms::connections::Segment *arg3 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "cell",(char *) "retSegment", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Connections_leastRecentlyUsedSegment",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_leastRecentlyUsedSegment" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Cell,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_leastRecentlyUsedSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_leastRecentlyUsedSegment" "', argument " "2"" of type '" "nupic::algorithms::connections::Cell const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Cell * >(argp2);
  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_nupic__algorithms__connections__Segment,  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Connections_leastRecentlyUsedSegment" "', argument " "3"" of type '" "nupic::algorithms::connections::Segment &""'"); 
  }
  if (!argp3) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_leastRecentlyUsedSegment" "', argument " "3"" of type '" "nupic::algorithms::connections::Segment &""'"); 
  }
  arg3 = reinterpret_cast< nupic::algorithms::connections::Segment * >(argp3);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Connections const *)arg1)->leastRecentlyUsedSegment((nupic::algorithms::connections::Cell const &)*arg2,*arg3);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_computeActivity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *arg2 = 0 ;
  nupic::algorithms::connections::Permanence arg3 ;
  nupic::algorithms::connections::SynapseIdx arg4 ;
  bool arg5 = (bool) true ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 = SWIG_OLDOBJ ;
  unsigned char val4 ;
  int ecode4 = 0 ;
  bool val5 ;
  int ecode5 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  PyObject * obj2 = 0 ;
  PyObject * obj3 = 0 ;
  PyObject * obj4 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "input",(char *) "permanenceThreshold",(char *) "synapseThreshold",(char *) "recordIteration", NULL 
  };
  nupic::algorithms::connections::Activity result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO|O:Connections_computeActivity",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_computeActivity" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *ptr = (std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *)0;
    res2 = swig::asptr(obj1, &ptr);
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_computeActivity" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    if (!ptr) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_computeActivity" "', argument " "2"" of type '" "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &""'"); 
    }
    arg2 = ptr;
  }
  {
    arg3 = (nupic::Real32) PyFloat_AsDouble(obj2);
  }
  ecode4 = SWIG_AsVal_unsigned_SS_char(obj3, &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Connections_computeActivity" "', argument " "4"" of type '" "nupic::algorithms::connections::SynapseIdx""'");
  } 
  arg4 = static_cast< nupic::algorithms::connections::SynapseIdx >(val4);
  if (obj4) {
    ecode5 = SWIG_AsVal_bool(obj4, &val5);
    if (!SWIG_IsOK(ecode5)) {
      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Connections_computeActivity" "', argument " "5"" of type '" "bool""'");
    } 
    arg5 = static_cast< bool >(val5);
  }
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->computeActivity((std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > const &)*arg2,arg3,arg4,arg5);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_NewPointerObj((new nupic::algorithms::connections::Activity(static_cast< const nupic::algorithms::connections::Activity& >(result))), SWIGTYPE_p_nupic__algorithms__connections__Activity, SWIG_POINTER_OWN |  0 );
  if (SWIG_IsNewObj(res2)) delete arg2;
  return resultobj;
fail:
  if (SWIG_IsNewObj(res2)) delete arg2;
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_activeSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Activity *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activity", NULL 
  };
  SwigValueWrapper< std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_activeSegments",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_activeSegments" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Activity,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_activeSegments" "', argument " "2"" of type '" "nupic::algorithms::connections::Activity const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_activeSegments" "', argument " "2"" of type '" "nupic::algorithms::connections::Activity const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->activeSegments((nupic::algorithms::connections::Activity const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_activeCells(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Activity *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "activity", NULL 
  };
  SwigValueWrapper< std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > > result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections_activeCells",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_activeCells" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Activity,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_activeCells" "', argument " "2"" of type '" "nupic::algorithms::connections::Activity const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_activeCells" "', argument " "2"" of type '" "nupic::algorithms::connections::Activity const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Activity * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (arg1)->activeCells((nupic::algorithms::connections::Activity const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = swig::from(static_cast< std::vector<nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_write__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  ostream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_write" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ostream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_write" "', argument " "2"" of type '" "ostream &""'"); 
  }
  arg2 = reinterpret_cast< ostream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::connections::Connections const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_write__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  ConnectionsProto::Builder *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_write" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ConnectionsProto__Builder,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_write" "', argument " "2"" of type '" "ConnectionsProto::Builder &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_write" "', argument " "2"" of type '" "ConnectionsProto::Builder &""'"); 
  }
  arg2 = reinterpret_cast< ConnectionsProto::Builder * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      ((nupic::algorithms::connections::Connections const *)arg1)->write(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_write(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Connections_write",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__connections__Connections, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ostream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__connections__Connections, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ConnectionsProto__Builder, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Connections_write__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Connections_write__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Connections_write'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Connections::write(ostream &) const\n"
    "    nupic::algorithms::connections::Connections::write(ConnectionsProto::Builder &) const\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Connections_read__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  istream *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_read" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_istream,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_read" "', argument " "2"" of type '" "istream &""'"); 
  }
  arg2 = reinterpret_cast< istream * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_read__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  ConnectionsProto::Reader *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_read" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_ConnectionsProto__Reader,  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections_read" "', argument " "2"" of type '" "ConnectionsProto::Reader &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections_read" "', argument " "2"" of type '" "ConnectionsProto::Reader &""'"); 
  }
  arg2 = reinterpret_cast< ConnectionsProto::Reader * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      (arg1)->read(*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_read(PyObject *self, PyObject *args) {
  int argc;
  PyObject *argv[3];
  
  if (!(argc = SWIG_Python_UnpackTuple(args,"Connections_read",0,2,argv))) SWIG_fail;
  --argc;
  {
    unsigned long _index = 0;
    SWIG_TypeRank _rank = 0; 
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__connections__Connections, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_istream, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_1;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 1;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_1:
    
    if (argc == 2) {
      SWIG_TypeRank _ranki = 0;
      SWIG_TypeRank _rankm = 0;
      SWIG_TypeRank _pi = 1;
      int _v = 0;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_nupic__algorithms__connections__Connections, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ConnectionsProto__Reader, 0);
        _v = SWIG_CheckState(res);
      }
      if (!_v) goto check_2;
      _ranki += _v*_pi;
      _rankm += _pi;
      _pi *= SWIG_MAXCASTRANK;
      if (!_index || (_ranki < _rank)) {
        _rank = _ranki; _index = 2;
        if (_rank == _rankm) goto dispatch;
      }
    }
  check_2:
    
  dispatch:
    switch(_index) {
    case 1:
      return _wrap_Connections_read__SWIG_0(self, argc, argv);
    case 2:
      return _wrap_Connections_read__SWIG_1(self, argc, argv);
    }
  }
  
fail:
  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Connections_read'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    nupic::algorithms::connections::Connections::read(istream &)\n"
    "    nupic::algorithms::connections::Connections::read(ConnectionsProto::Reader &)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_Connections_numSegments(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_numSegments" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::connections::Connections const *)arg1)->numSegments();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections_numSynapses(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  nupic::UInt result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections_numSynapses" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (nupic::UInt)((nupic::algorithms::connections::Connections const *)arg1)->numSynapses();
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_Connections___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  nupic::algorithms::connections::Connections *arg1 = (nupic::algorithms::connections::Connections *) 0 ;
  nupic::algorithms::connections::Connections *arg2 = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject * obj0 = 0 ;
  PyObject * obj1 = 0 ;
  char *  kwnames[] = {
    (char *) "self",(char *) "other", NULL 
  };
  bool result;
  
  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Connections___eq__",kwnames,&obj0,&obj1)) SWIG_fail;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nupic__algorithms__connections__Connections, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Connections___eq__" "', argument " "1"" of type '" "nupic::algorithms::connections::Connections const *""'"); 
  }
  arg1 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp1);
  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_nupic__algorithms__connections__Connections,  0  | 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Connections___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Connections const &""'"); 
  }
  if (!argp2) {
    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Connections___eq__" "', argument " "2"" of type '" "nupic::algorithms::connections::Connections const &""'"); 
  }
  arg2 = reinterpret_cast< nupic::algorithms::connections::Connections * >(argp2);
  {
    // simplified from NuPIC 1.x exception_py.i and nupic_cpplibs/PythonExceptions.hpp
    try
    {
      result = (bool)((nupic::algorithms::connections::Connections const *)arg1)->operator ==((nupic::algorithms::connections::Connections const &)*arg2);
    }
    catch (const nupic::Exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred())
      {
        // Create a RuntimeError Python exception object
        nupic::py::Tuple args(1);
        args.setItem(0, nupic::py::String(e.getMessage()));
        nupic::py::Instance ex(PyExc_RuntimeError, args);
        
        // Add a new attribute "stackTrace" if available
        if (e.getStackTrace())
        {
          ex.setAttr("stackTrace", nupic::py::String(e.getStackTrace()));
          //nupic::py::String st(ex.getAttr("stackTrace"));
          //NTA_DEBUG << "*** stackTrace: " << std::string(st);
          //NTA_ASSERT(!(std::string(st).empty()));
        }
        
        // Set the Python error. Equivalent to: "raise ex"
        PyErr_SetObject(PyExc_RuntimeError, ex);      
      }
      SWIG_fail;
    }
    
    catch (const std::exception & e)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, const_cast<char *>(e.what()));
      SWIG_fail;
    }
    
    catch (...)
    {
      // Don't replace the error message if it is already set
      if (!PyErr_Occurred()) 
      PyErr_SetString(PyExc_RuntimeError, "Unknown error from C++ library");
      SWIG_fail;
    }
  }
  resultobj = SWIG_From_bool(static_cast< bool >(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *Connections_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
  PyObject *obj;
  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
  SWIG_TypeNewClientData(SWIGTYPE_p_nupic__algorithms__connections__Connections, SWIG_NewClientData(obj));
  return SWIG_Py_Void();
}

static PyMethodDef SwigMethods[] = {
	 { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
	 { (char *)"forceRetentionOfGaborComputeWithinLibrary", (PyCFunction)_wrap_forceRetentionOfGaborComputeWithinLibrary, METH_NOARGS, (char *)"forceRetentionOfGaborComputeWithinLibrary()"},
	 { (char *)"forceRetentionOfImageSensorLiteLibrary", (PyCFunction)_wrap_forceRetentionOfImageSensorLiteLibrary, METH_NOARGS, (char *)"forceRetentionOfImageSensorLiteLibrary()"},
	 { (char *)"feature_node_index_set", _wrap_feature_node_index_set, METH_VARARGS, (char *)"feature_node_index_set(self, index)"},
	 { (char *)"feature_node_index_get", (PyCFunction)_wrap_feature_node_index_get, METH_O, (char *)"feature_node_index_get(self) -> int"},
	 { (char *)"feature_node_value_set", _wrap_feature_node_value_set, METH_VARARGS, (char *)"feature_node_value_set(self, value)"},
	 { (char *)"feature_node_value_get", (PyCFunction)_wrap_feature_node_value_get, METH_O, (char *)"feature_node_value_get(self) -> float"},
	 { (char *)"new_feature_node", (PyCFunction)_wrap_new_feature_node, METH_NOARGS, (char *)"new_feature_node() -> feature_node"},
	 { (char *)"delete_feature_node", (PyCFunction)_wrap_delete_feature_node, METH_O, (char *)"delete_feature_node(self)"},
	 { (char *)"feature_node_swigregister", feature_node_swigregister, METH_VARARGS, NULL},
	 { (char *)"sparse_feature_vector_data_set", _wrap_sparse_feature_vector_data_set, METH_VARARGS, (char *)"sparse_feature_vector_data_set(self, data)"},
	 { (char *)"sparse_feature_vector_data_get", (PyCFunction)_wrap_sparse_feature_vector_data_get, METH_O, (char *)"sparse_feature_vector_data_get(self) -> feature_node"},
	 { (char *)"new_sparse_feature_vector", _wrap_new_sparse_feature_vector, METH_VARARGS, (char *)"\n"
		"sparse_feature_vector()\n"
		"new_sparse_feature_vector(n, dense_array) -> sparse_feature_vector\n"
		""},
	 { (char *)"delete_sparse_feature_vector", (PyCFunction)_wrap_delete_sparse_feature_vector, METH_O, (char *)"delete_sparse_feature_vector(self)"},
	 { (char *)"sparse_feature_vector_swigregister", sparse_feature_vector_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_problem", (PyCFunction) _wrap_new_problem, METH_VARARGS | METH_KEYWORDS, (char *)"new_problem(l_, n_, bias_) -> problem"},
	 { (char *)"delete_problem", (PyCFunction)_wrap_delete_problem, METH_O, (char *)"delete_problem(self)"},
	 { (char *)"problem_l_set", _wrap_problem_l_set, METH_VARARGS, (char *)"problem_l_set(self, l)"},
	 { (char *)"problem_l_get", (PyCFunction)_wrap_problem_l_get, METH_O, (char *)"problem_l_get(self) -> int"},
	 { (char *)"problem_n_set", _wrap_problem_n_set, METH_VARARGS, (char *)"problem_n_set(self, n)"},
	 { (char *)"problem_n_get", (PyCFunction)_wrap_problem_n_get, METH_O, (char *)"problem_n_get(self) -> int"},
	 { (char *)"problem_bias_set", _wrap_problem_bias_set, METH_VARARGS, (char *)"problem_bias_set(self, bias)"},
	 { (char *)"problem_bias_get", (PyCFunction)_wrap_problem_bias_get, METH_O, (char *)"problem_bias_get(self) -> float"},
	 { (char *)"problem_y_set", _wrap_problem_y_set, METH_VARARGS, (char *)"problem_y_set(self, y)"},
	 { (char *)"problem_y_get", (PyCFunction)_wrap_problem_y_get, METH_O, (char *)"problem_y_get(self) -> int *"},
	 { (char *)"problem_x_set", _wrap_problem_x_set, METH_VARARGS, (char *)"problem_x_set(self, x)"},
	 { (char *)"problem_x_get", (PyCFunction)_wrap_problem_x_get, METH_O, (char *)"problem_x_get(self) -> nupic::algorithms::linear::feature_node **"},
	 { (char *)"problem_swigregister", problem_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_parameter", _wrap_new_parameter, METH_VARARGS, (char *)"\n"
		"parameter()\n"
		"new_parameter(solver_type_, eps_, C_, nr_weight_=0, weight_label_=None, weight_=None) -> parameter\n"
		""},
	 { (char *)"delete_parameter", (PyCFunction)_wrap_delete_parameter, METH_O, (char *)"delete_parameter(self)"},
	 { (char *)"parameter_solver_type_set", _wrap_parameter_solver_type_set, METH_VARARGS, (char *)"parameter_solver_type_set(self, solver_type)"},
	 { (char *)"parameter_solver_type_get", (PyCFunction)_wrap_parameter_solver_type_get, METH_O, (char *)"parameter_solver_type_get(self) -> int"},
	 { (char *)"parameter_eps_set", _wrap_parameter_eps_set, METH_VARARGS, (char *)"parameter_eps_set(self, eps)"},
	 { (char *)"parameter_eps_get", (PyCFunction)_wrap_parameter_eps_get, METH_O, (char *)"parameter_eps_get(self) -> float"},
	 { (char *)"parameter_C_set", _wrap_parameter_C_set, METH_VARARGS, (char *)"parameter_C_set(self, C)"},
	 { (char *)"parameter_C_get", (PyCFunction)_wrap_parameter_C_get, METH_O, (char *)"parameter_C_get(self) -> float"},
	 { (char *)"parameter_nr_weight_set", _wrap_parameter_nr_weight_set, METH_VARARGS, (char *)"parameter_nr_weight_set(self, nr_weight)"},
	 { (char *)"parameter_nr_weight_get", (PyCFunction)_wrap_parameter_nr_weight_get, METH_O, (char *)"parameter_nr_weight_get(self) -> int"},
	 { (char *)"parameter_weight_label_set", _wrap_parameter_weight_label_set, METH_VARARGS, (char *)"parameter_weight_label_set(self, weight_label)"},
	 { (char *)"parameter_weight_label_get", (PyCFunction)_wrap_parameter_weight_label_get, METH_O, (char *)"parameter_weight_label_get(self) -> int *"},
	 { (char *)"parameter_weight_set", _wrap_parameter_weight_set, METH_VARARGS, (char *)"parameter_weight_set(self, weight)"},
	 { (char *)"parameter_weight_get", (PyCFunction)_wrap_parameter_weight_get, METH_O, (char *)"parameter_weight_get(self) -> float *"},
	 { (char *)"parameter_swigregister", parameter_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_model", (PyCFunction)_wrap_new_model, METH_NOARGS, (char *)"new_model() -> model"},
	 { (char *)"delete_model", (PyCFunction)_wrap_delete_model, METH_O, (char *)"delete_model(self)"},
	 { (char *)"model_get_labels", (PyCFunction) _wrap_model_get_labels, METH_VARARGS | METH_KEYWORDS, (char *)"model_get_labels(self, label)"},
	 { (char *)"model_param_set", _wrap_model_param_set, METH_VARARGS, (char *)"model_param_set(self, param)"},
	 { (char *)"model_param_get", (PyCFunction)_wrap_model_param_get, METH_O, (char *)"model_param_get(self) -> parameter"},
	 { (char *)"model_nr_class_set", _wrap_model_nr_class_set, METH_VARARGS, (char *)"model_nr_class_set(self, nr_class)"},
	 { (char *)"model_nr_class_get", (PyCFunction)_wrap_model_nr_class_get, METH_O, (char *)"model_nr_class_get(self) -> int"},
	 { (char *)"model_nr_feature_set", _wrap_model_nr_feature_set, METH_VARARGS, (char *)"model_nr_feature_set(self, nr_feature)"},
	 { (char *)"model_nr_feature_get", (PyCFunction)_wrap_model_nr_feature_get, METH_O, (char *)"model_nr_feature_get(self) -> int"},
	 { (char *)"model_w_set", _wrap_model_w_set, METH_VARARGS, (char *)"model_w_set(self, w)"},
	 { (char *)"model_w_get", (PyCFunction)_wrap_model_w_get, METH_O, (char *)"model_w_get(self) -> float *"},
	 { (char *)"model_label_set", _wrap_model_label_set, METH_VARARGS, (char *)"model_label_set(self, label)"},
	 { (char *)"model_label_get", (PyCFunction)_wrap_model_label_get, METH_O, (char *)"model_label_get(self) -> int *"},
	 { (char *)"model_bias_set", _wrap_model_bias_set, METH_VARARGS, (char *)"model_bias_set(self, bias)"},
	 { (char *)"model_bias_get", (PyCFunction)_wrap_model_bias_get, METH_O, (char *)"model_bias_get(self) -> float"},
	 { (char *)"model_swigregister", model_swigregister, METH_VARARGS, NULL},
	 { (char *)"function_fun", (PyCFunction) _wrap_function_fun, METH_VARARGS | METH_KEYWORDS, (char *)"function_fun(self, w) -> float"},
	 { (char *)"function_grad", (PyCFunction) _wrap_function_grad, METH_VARARGS | METH_KEYWORDS, (char *)"function_grad(self, w, g)"},
	 { (char *)"function_Hv", (PyCFunction) _wrap_function_Hv, METH_VARARGS | METH_KEYWORDS, (char *)"function_Hv(self, s, Hs)"},
	 { (char *)"function_get_nr_variable", (PyCFunction)_wrap_function_get_nr_variable, METH_O, (char *)"function_get_nr_variable(self) -> int"},
	 { (char *)"delete_function", (PyCFunction)_wrap_delete_function, METH_O, (char *)"delete_function(self)"},
	 { (char *)"function_swigregister", function_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_TRON", (PyCFunction) _wrap_new_TRON, METH_VARARGS | METH_KEYWORDS, (char *)"new_TRON(fun_obj, eps=0.1, max_iter=1000) -> TRON"},
	 { (char *)"delete_TRON", (PyCFunction)_wrap_delete_TRON, METH_O, (char *)"delete_TRON(self)"},
	 { (char *)"TRON_tron", (PyCFunction) _wrap_TRON_tron, METH_VARARGS | METH_KEYWORDS, (char *)"TRON_tron(self, w)"},
	 { (char *)"TRON_swigregister", TRON_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_linear", (PyCFunction) _wrap_new_linear, METH_VARARGS | METH_KEYWORDS, (char *)"new_linear(solver_type, eps, C, nr_weight=0, weight_label=None, weight=None) -> linear"},
	 { (char *)"delete_linear", (PyCFunction)_wrap_delete_linear, METH_O, (char *)"delete_linear(self)"},
	 { (char *)"linear_x_space_set", _wrap_linear_x_space_set, METH_VARARGS, (char *)"linear_x_space_set(self, x_space)"},
	 { (char *)"linear_x_space_get", (PyCFunction)_wrap_linear_x_space_get, METH_O, (char *)"linear_x_space_get(self) -> feature_node"},
	 { (char *)"linear_the_param_set", _wrap_linear_the_param_set, METH_VARARGS, (char *)"linear_the_param_set(self, the_param)"},
	 { (char *)"linear_the_param_get", (PyCFunction)_wrap_linear_the_param_get, METH_O, (char *)"linear_the_param_get(self) -> parameter"},
	 { (char *)"linear_the_problem_set", _wrap_linear_the_problem_set, METH_VARARGS, (char *)"linear_the_problem_set(self, the_problem)"},
	 { (char *)"linear_the_problem_get", (PyCFunction)_wrap_linear_the_problem_get, METH_O, (char *)"linear_the_problem_get(self) -> problem"},
	 { (char *)"linear_the_model_set", _wrap_linear_the_model_set, METH_VARARGS, (char *)"linear_the_model_set(self, the_model)"},
	 { (char *)"linear_the_model_get", (PyCFunction)_wrap_linear_the_model_get, METH_O, (char *)"linear_the_model_get(self) -> model"},
	 { (char *)"linear_train", (PyCFunction)_wrap_linear_train, METH_O, (char *)"linear_train(self)"},
	 { (char *)"linear_save_model", (PyCFunction) _wrap_linear_save_model, METH_VARARGS | METH_KEYWORDS, (char *)"linear_save_model(self, model_file_name) -> int"},
	 { (char *)"linear_load_model", (PyCFunction) _wrap_linear_load_model, METH_VARARGS | METH_KEYWORDS, (char *)"linear_load_model(self, model_file_name)"},
	 { (char *)"linear_create_problem", _wrap_linear_create_problem, METH_VARARGS, (char *)"\n"
		"create_problem(l, n, y, x, bias=-1.0)\n"
		"linear_create_problem(self, size, n_dims, labelsIn, samplesIn, bias=-1.0)\n"
		""},
	 { (char *)"linear_cross_validation", _wrap_linear_cross_validation, METH_VARARGS, (char *)"\n"
		"cross_validation(nr_fold, target)\n"
		"linear_cross_validation(self, nr_fold, py_target)\n"
		""},
	 { (char *)"linear_predict_values", _wrap_linear_predict_values, METH_VARARGS, (char *)"\n"
		"predict_values(x, dec_values) -> int\n"
		"linear_predict_values(self, py_x, py_dec_values) -> int\n"
		""},
	 { (char *)"linear_predict", _wrap_linear_predict, METH_VARARGS, (char *)"\n"
		"predict(x) -> int\n"
		"linear_predict(self, py_x) -> int\n"
		""},
	 { (char *)"linear_predict_probability", _wrap_linear_predict_probability, METH_VARARGS, (char *)"\n"
		"predict_probability(x, prob_estimates) -> int\n"
		"linear_predict_probability(self, py_x, py_prob_estimates) -> int\n"
		""},
	 { (char *)"linear_swigregister", linear_swigregister, METH_VARARGS, NULL},
	 { (char *)"svm_problem_recover__set", _wrap_svm_problem_recover__set, METH_VARARGS, (char *)"svm_problem_recover__set(self, recover_)"},
	 { (char *)"svm_problem_recover__get", (PyCFunction)_wrap_svm_problem_recover__get, METH_O, (char *)"svm_problem_recover__get(self) -> bool"},
	 { (char *)"svm_problem_n_dims__set", _wrap_svm_problem_n_dims__set, METH_VARARGS, (char *)"svm_problem_n_dims__set(self, n_dims_)"},
	 { (char *)"svm_problem_n_dims__get", (PyCFunction)_wrap_svm_problem_n_dims__get, METH_O, (char *)"svm_problem_n_dims__get(self) -> int"},
	 { (char *)"svm_problem_x__set", _wrap_svm_problem_x__set, METH_VARARGS, (char *)"svm_problem_x__set(self, x_)"},
	 { (char *)"svm_problem_x__get", (PyCFunction)_wrap_svm_problem_x__get, METH_O, (char *)"svm_problem_x__get(self) -> std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > const &"},
	 { (char *)"svm_problem_y__set", _wrap_svm_problem_y__set, METH_VARARGS, (char *)"svm_problem_y__set(self, y_)"},
	 { (char *)"svm_problem_y__get", (PyCFunction)_wrap_svm_problem_y__get, METH_O, (char *)"svm_problem_y__get(self) -> FloatVector"},
	 { (char *)"new_svm_problem", _wrap_new_svm_problem, METH_VARARGS, (char *)"\n"
		"svm_problem(n_dims, recover, arg4=0)\n"
		"svm_problem(n_dims, size, recover, arg5=0)\n"
		"new_svm_problem(inStream) -> svm_problem\n"
		""},
	 { (char *)"delete_svm_problem", (PyCFunction)_wrap_delete_svm_problem, METH_O, (char *)"delete_svm_problem(self)"},
	 { (char *)"svm_problem_size", (PyCFunction)_wrap_svm_problem_size, METH_O, (char *)"svm_problem_size(self) -> int"},
	 { (char *)"svm_problem_n_dims", (PyCFunction)_wrap_svm_problem_n_dims, METH_O, (char *)"svm_problem_n_dims(self) -> int"},
	 { (char *)"svm_problem_nnz", (PyCFunction) _wrap_svm_problem_nnz, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_nnz(self, i) -> int"},
	 { (char *)"svm_problem_resize", (PyCFunction) _wrap_svm_problem_resize, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_resize(self, n)"},
	 { (char *)"svm_problem_set_sample", (PyCFunction) _wrap_svm_problem_set_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_set_sample(self, i, s)"},
	 { (char *)"svm_problem_get_sample", (PyCFunction) _wrap_svm_problem_get_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_get_sample(self, i) -> nupic::algorithms::svm::svm_problem::sample_type"},
	 { (char *)"svm_problem_dense", (PyCFunction) _wrap_svm_problem_dense, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_dense(self, i, sv)"},
	 { (char *)"svm_problem_persistent_size", (PyCFunction)_wrap_svm_problem_persistent_size, METH_O, (char *)"svm_problem_persistent_size(self) -> int"},
	 { (char *)"svm_problem_save", (PyCFunction) _wrap_svm_problem_save, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_save(self, outStream)"},
	 { (char *)"svm_problem_load", (PyCFunction) _wrap_svm_problem_load, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_load(self, inStream)"},
	 { (char *)"svm_problem_get_samples", (PyCFunction) _wrap_svm_problem_get_samples, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem_get_samples(self, samplesIn)"},
	 { (char *)"svm_problem_swigregister", svm_problem_swigregister, METH_VARARGS, NULL},
	 { (char *)"svm_problem01_recover__set", _wrap_svm_problem01_recover__set, METH_VARARGS, (char *)"svm_problem01_recover__set(self, recover_)"},
	 { (char *)"svm_problem01_recover__get", (PyCFunction)_wrap_svm_problem01_recover__get, METH_O, (char *)"svm_problem01_recover__get(self) -> bool"},
	 { (char *)"svm_problem01_n_dims__set", _wrap_svm_problem01_n_dims__set, METH_VARARGS, (char *)"svm_problem01_n_dims__set(self, n_dims_)"},
	 { (char *)"svm_problem01_n_dims__get", (PyCFunction)_wrap_svm_problem01_n_dims__get, METH_O, (char *)"svm_problem01_n_dims__get(self) -> int"},
	 { (char *)"svm_problem01_threshold__set", _wrap_svm_problem01_threshold__set, METH_VARARGS, (char *)"svm_problem01_threshold__set(self, threshold_)"},
	 { (char *)"svm_problem01_threshold__get", (PyCFunction)_wrap_svm_problem01_threshold__get, METH_O, (char *)"svm_problem01_threshold__get(self) -> float"},
	 { (char *)"svm_problem01_nnz__set", _wrap_svm_problem01_nnz__set, METH_VARARGS, (char *)"svm_problem01_nnz__set(self, nnz_)"},
	 { (char *)"svm_problem01_nnz__get", (PyCFunction)_wrap_svm_problem01_nnz__get, METH_O, (char *)"svm_problem01_nnz__get(self) -> VectorOfInt32"},
	 { (char *)"svm_problem01_x__set", _wrap_svm_problem01_x__set, METH_VARARGS, (char *)"svm_problem01_x__set(self, x_)"},
	 { (char *)"svm_problem01_x__get", (PyCFunction)_wrap_svm_problem01_x__get, METH_O, (char *)"svm_problem01_x__get(self) -> std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > const &"},
	 { (char *)"svm_problem01_y__set", _wrap_svm_problem01_y__set, METH_VARARGS, (char *)"svm_problem01_y__set(self, y_)"},
	 { (char *)"svm_problem01_y__get", (PyCFunction)_wrap_svm_problem01_y__get, METH_O, (char *)"svm_problem01_y__get(self) -> FloatVector"},
	 { (char *)"svm_problem01_buf__set", _wrap_svm_problem01_buf__set, METH_VARARGS, (char *)"svm_problem01_buf__set(self, buf_)"},
	 { (char *)"svm_problem01_buf__get", (PyCFunction)_wrap_svm_problem01_buf__get, METH_O, (char *)"svm_problem01_buf__get(self) -> VectorOfInt32"},
	 { (char *)"new_svm_problem01", _wrap_new_svm_problem01, METH_VARARGS, (char *)"\n"
		"svm_problem01(n_dims, recover, threshold=.9)\n"
		"svm_problem01(n_dims, size, recover, threshold=.9)\n"
		"new_svm_problem01(inStream) -> svm_problem01\n"
		""},
	 { (char *)"delete_svm_problem01", (PyCFunction)_wrap_delete_svm_problem01, METH_O, (char *)"delete_svm_problem01(self)"},
	 { (char *)"svm_problem01_size", (PyCFunction)_wrap_svm_problem01_size, METH_O, (char *)"svm_problem01_size(self) -> int"},
	 { (char *)"svm_problem01_n_dims", (PyCFunction)_wrap_svm_problem01_n_dims, METH_O, (char *)"svm_problem01_n_dims(self) -> int"},
	 { (char *)"svm_problem01_nnz", (PyCFunction) _wrap_svm_problem01_nnz, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_nnz(self, i) -> int"},
	 { (char *)"svm_problem01_resize", (PyCFunction) _wrap_svm_problem01_resize, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_resize(self, n)"},
	 { (char *)"svm_problem01_set_sample", (PyCFunction) _wrap_svm_problem01_set_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_set_sample(self, i, s)"},
	 { (char *)"svm_problem01_get_sample", (PyCFunction) _wrap_svm_problem01_get_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_get_sample(self, i) -> nupic::algorithms::svm::svm_problem01::sample_type"},
	 { (char *)"svm_problem01_dense", (PyCFunction) _wrap_svm_problem01_dense, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_dense(self, i, sv)"},
	 { (char *)"svm_problem01_persistent_size", (PyCFunction)_wrap_svm_problem01_persistent_size, METH_O, (char *)"svm_problem01_persistent_size(self) -> int"},
	 { (char *)"svm_problem01_save", (PyCFunction) _wrap_svm_problem01_save, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_save(self, outStream)"},
	 { (char *)"svm_problem01_load", (PyCFunction) _wrap_svm_problem01_load, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_load(self, inStream)"},
	 { (char *)"svm_problem01_get_samples", (PyCFunction) _wrap_svm_problem01_get_samples, METH_VARARGS | METH_KEYWORDS, (char *)"svm_problem01_get_samples(self, samplesIn)"},
	 { (char *)"svm_problem01_swigregister", svm_problem01_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_decision_function", (PyCFunction)_wrap_new_decision_function, METH_NOARGS, (char *)"new_decision_function() -> decision_function"},
	 { (char *)"delete_decision_function", (PyCFunction)_wrap_delete_decision_function, METH_O, (char *)"delete_decision_function(self)"},
	 { (char *)"decision_function_alpha_set", _wrap_decision_function_alpha_set, METH_VARARGS, (char *)"decision_function_alpha_set(self, alpha)"},
	 { (char *)"decision_function_alpha_get", (PyCFunction)_wrap_decision_function_alpha_get, METH_O, (char *)"decision_function_alpha_get(self) -> float *"},
	 { (char *)"decision_function_rho_set", _wrap_decision_function_rho_set, METH_VARARGS, (char *)"decision_function_rho_set(self, rho)"},
	 { (char *)"decision_function_rho_get", (PyCFunction)_wrap_decision_function_rho_get, METH_O, (char *)"decision_function_rho_get(self) -> float"},
	 { (char *)"decision_function_swigregister", decision_function_swigregister, METH_VARARGS, NULL},
	 { (char *)"svm_model_n_dims__set", _wrap_svm_model_n_dims__set, METH_VARARGS, (char *)"svm_model_n_dims__set(self, n_dims_)"},
	 { (char *)"svm_model_n_dims__get", (PyCFunction)_wrap_svm_model_n_dims__get, METH_O, (char *)"svm_model_n_dims__get(self) -> int"},
	 { (char *)"svm_model_sv_mem_set", _wrap_svm_model_sv_mem_set, METH_VARARGS, (char *)"svm_model_sv_mem_set(self, sv_mem)"},
	 { (char *)"svm_model_sv_mem_get", (PyCFunction)_wrap_svm_model_sv_mem_get, METH_O, (char *)"svm_model_sv_mem_get(self) -> float *"},
	 { (char *)"svm_model_sv_set", _wrap_svm_model_sv_set, METH_VARARGS, (char *)"svm_model_sv_set(self, sv)"},
	 { (char *)"svm_model_sv_get", (PyCFunction)_wrap_svm_model_sv_get, METH_O, (char *)"svm_model_sv_get(self) -> std::vector< float *,std::allocator< float * > > const &"},
	 { (char *)"svm_model_sv_coef_set", _wrap_svm_model_sv_coef_set, METH_VARARGS, (char *)"svm_model_sv_coef_set(self, sv_coef)"},
	 { (char *)"svm_model_sv_coef_get", (PyCFunction)_wrap_svm_model_sv_coef_get, METH_O, (char *)"svm_model_sv_coef_get(self) -> std::vector< float *,std::allocator< float * > > const &"},
	 { (char *)"svm_model_rho_set", _wrap_svm_model_rho_set, METH_VARARGS, (char *)"svm_model_rho_set(self, rho)"},
	 { (char *)"svm_model_rho_get", (PyCFunction)_wrap_svm_model_rho_get, METH_O, (char *)"svm_model_rho_get(self) -> FloatVector"},
	 { (char *)"svm_model_label_set", _wrap_svm_model_label_set, METH_VARARGS, (char *)"svm_model_label_set(self, label)"},
	 { (char *)"svm_model_label_get", (PyCFunction)_wrap_svm_model_label_get, METH_O, (char *)"svm_model_label_get(self) -> VectorOfInt32"},
	 { (char *)"svm_model_n_sv_set", _wrap_svm_model_n_sv_set, METH_VARARGS, (char *)"svm_model_n_sv_set(self, n_sv)"},
	 { (char *)"svm_model_n_sv_get", (PyCFunction)_wrap_svm_model_n_sv_get, METH_O, (char *)"svm_model_n_sv_get(self) -> VectorOfInt32"},
	 { (char *)"svm_model_probA_set", _wrap_svm_model_probA_set, METH_VARARGS, (char *)"svm_model_probA_set(self, probA)"},
	 { (char *)"svm_model_probA_get", (PyCFunction)_wrap_svm_model_probA_get, METH_O, (char *)"svm_model_probA_get(self) -> FloatVector"},
	 { (char *)"svm_model_probB_set", _wrap_svm_model_probB_set, METH_VARARGS, (char *)"svm_model_probB_set(self, probB)"},
	 { (char *)"svm_model_probB_get", (PyCFunction)_wrap_svm_model_probB_get, METH_O, (char *)"svm_model_probB_get(self) -> FloatVector"},
	 { (char *)"svm_model_w_set", _wrap_svm_model_w_set, METH_VARARGS, (char *)"svm_model_w_set(self, w)"},
	 { (char *)"svm_model_w_get", (PyCFunction)_wrap_svm_model_w_get, METH_O, (char *)"svm_model_w_get(self) -> std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > const &"},
	 { (char *)"svm_model_size", (PyCFunction)_wrap_svm_model_size, METH_O, (char *)"svm_model_size(self) -> int"},
	 { (char *)"svm_model_n_dims", (PyCFunction)_wrap_svm_model_n_dims, METH_O, (char *)"svm_model_n_dims(self) -> int"},
	 { (char *)"svm_model_n_class", (PyCFunction)_wrap_svm_model_n_class, METH_O, (char *)"svm_model_n_class(self) -> int"},
	 { (char *)"new_svm_model", (PyCFunction)_wrap_new_svm_model, METH_NOARGS, (char *)"new_svm_model() -> svm_model"},
	 { (char *)"delete_svm_model", (PyCFunction)_wrap_delete_svm_model, METH_O, (char *)"delete_svm_model(self)"},
	 { (char *)"svm_model_persistent_size", (PyCFunction)_wrap_svm_model_persistent_size, METH_O, (char *)"svm_model_persistent_size(self) -> int"},
	 { (char *)"svm_model_save", (PyCFunction) _wrap_svm_model_save, METH_VARARGS | METH_KEYWORDS, (char *)"svm_model_save(self, outStream)"},
	 { (char *)"svm_model_load", (PyCFunction) _wrap_svm_model_load, METH_VARARGS | METH_KEYWORDS, (char *)"svm_model_load(self, inStream)"},
	 { (char *)"svm_model_get_support_vectors", (PyCFunction) _wrap_svm_model_get_support_vectors, METH_VARARGS | METH_KEYWORDS, (char *)"svm_model_get_support_vectors(self, svIn)"},
	 { (char *)"svm_model_get_support_vector_coefficients", (PyCFunction) _wrap_svm_model_get_support_vector_coefficients, METH_VARARGS | METH_KEYWORDS, (char *)"svm_model_get_support_vector_coefficients(self, svCoeffIn)"},
	 { (char *)"svm_model_get_hyperplanes", (PyCFunction)_wrap_svm_model_get_hyperplanes, METH_O, (char *)"svm_model_get_hyperplanes(self) -> PyObject *"},
	 { (char *)"svm_model_swigregister", svm_model_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_QMatrix", (PyCFunction) _wrap_new_QMatrix, METH_VARARGS | METH_KEYWORDS, (char *)"new_QMatrix(prob, g, kernel, cache_size) -> QMatrix"},
	 { (char *)"delete_QMatrix", (PyCFunction)_wrap_delete_QMatrix, METH_O, (char *)"delete_QMatrix(self)"},
	 { (char *)"QMatrix_get_Q", (PyCFunction) _wrap_QMatrix_get_Q, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix_get_Q(self, i, len) -> float *"},
	 { (char *)"QMatrix_get_QD", (PyCFunction)_wrap_QMatrix_get_QD, METH_O, (char *)"QMatrix_get_QD(self) -> float *"},
	 { (char *)"QMatrix_swap_index", (PyCFunction) _wrap_QMatrix_swap_index, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix_swap_index(self, i, j)"},
	 { (char *)"QMatrix_dot", (PyCFunction) _wrap_QMatrix_dot, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix_dot(self, i, j) -> nupic::algorithms::svm::QMatrix::feature_type"},
	 { (char *)"QMatrix_linear_kernel", (PyCFunction) _wrap_QMatrix_linear_kernel, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix_linear_kernel(self, i, j) -> float"},
	 { (char *)"QMatrix_rbf_kernel", (PyCFunction) _wrap_QMatrix_rbf_kernel, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix_rbf_kernel(self, i, j) -> float"},
	 { (char *)"QMatrix_swigregister", QMatrix_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_QMatrix01", (PyCFunction) _wrap_new_QMatrix01, METH_VARARGS | METH_KEYWORDS, (char *)"new_QMatrix01(prob, g, kernel, cache_size) -> QMatrix01"},
	 { (char *)"delete_QMatrix01", (PyCFunction)_wrap_delete_QMatrix01, METH_O, (char *)"delete_QMatrix01(self)"},
	 { (char *)"QMatrix01_get_Q", (PyCFunction) _wrap_QMatrix01_get_Q, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix01_get_Q(self, i, len) -> float *"},
	 { (char *)"QMatrix01_get_QD", (PyCFunction)_wrap_QMatrix01_get_QD, METH_O, (char *)"QMatrix01_get_QD(self) -> float *"},
	 { (char *)"QMatrix01_swap_index", (PyCFunction) _wrap_QMatrix01_swap_index, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix01_swap_index(self, i, j)"},
	 { (char *)"QMatrix01_dot", (PyCFunction) _wrap_QMatrix01_dot, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix01_dot(self, i, j) -> nupic::algorithms::svm::QMatrix01::feature_type"},
	 { (char *)"QMatrix01_linear_kernel", (PyCFunction) _wrap_QMatrix01_linear_kernel, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix01_linear_kernel(self, i, j) -> float"},
	 { (char *)"QMatrix01_rbf_kernel", (PyCFunction) _wrap_QMatrix01_rbf_kernel, METH_VARARGS | METH_KEYWORDS, (char *)"QMatrix01_rbf_kernel(self, i, j) -> float"},
	 { (char *)"QMatrix01_swigregister", QMatrix01_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_svm_parameter", (PyCFunction) _wrap_new_svm_parameter, METH_VARARGS | METH_KEYWORDS, (char *)"new_svm_parameter(k, p, g, c, e, cs, s) -> svm_parameter"},
	 { (char *)"svm_parameter_kernel_set", _wrap_svm_parameter_kernel_set, METH_VARARGS, (char *)"svm_parameter_kernel_set(self, kernel)"},
	 { (char *)"svm_parameter_kernel_get", (PyCFunction)_wrap_svm_parameter_kernel_get, METH_O, (char *)"svm_parameter_kernel_get(self) -> int"},
	 { (char *)"svm_parameter_probability_set", _wrap_svm_parameter_probability_set, METH_VARARGS, (char *)"svm_parameter_probability_set(self, probability)"},
	 { (char *)"svm_parameter_probability_get", (PyCFunction)_wrap_svm_parameter_probability_get, METH_O, (char *)"svm_parameter_probability_get(self) -> bool"},
	 { (char *)"svm_parameter_gamma_set", _wrap_svm_parameter_gamma_set, METH_VARARGS, (char *)"svm_parameter_gamma_set(self, gamma)"},
	 { (char *)"svm_parameter_gamma_get", (PyCFunction)_wrap_svm_parameter_gamma_get, METH_O, (char *)"svm_parameter_gamma_get(self) -> float"},
	 { (char *)"svm_parameter_C_set", _wrap_svm_parameter_C_set, METH_VARARGS, (char *)"svm_parameter_C_set(self, C)"},
	 { (char *)"svm_parameter_C_get", (PyCFunction)_wrap_svm_parameter_C_get, METH_O, (char *)"svm_parameter_C_get(self) -> float"},
	 { (char *)"svm_parameter_eps_set", _wrap_svm_parameter_eps_set, METH_VARARGS, (char *)"svm_parameter_eps_set(self, eps)"},
	 { (char *)"svm_parameter_eps_get", (PyCFunction)_wrap_svm_parameter_eps_get, METH_O, (char *)"svm_parameter_eps_get(self) -> float"},
	 { (char *)"svm_parameter_cache_size_set", _wrap_svm_parameter_cache_size_set, METH_VARARGS, (char *)"svm_parameter_cache_size_set(self, cache_size)"},
	 { (char *)"svm_parameter_cache_size_get", (PyCFunction)_wrap_svm_parameter_cache_size_get, METH_O, (char *)"svm_parameter_cache_size_get(self) -> int"},
	 { (char *)"svm_parameter_shrinking_set", _wrap_svm_parameter_shrinking_set, METH_VARARGS, (char *)"svm_parameter_shrinking_set(self, shrinking)"},
	 { (char *)"svm_parameter_shrinking_get", (PyCFunction)_wrap_svm_parameter_shrinking_get, METH_O, (char *)"svm_parameter_shrinking_get(self) -> int"},
	 { (char *)"svm_parameter_weight_label_set", _wrap_svm_parameter_weight_label_set, METH_VARARGS, (char *)"svm_parameter_weight_label_set(self, weight_label)"},
	 { (char *)"svm_parameter_weight_label_get", (PyCFunction)_wrap_svm_parameter_weight_label_get, METH_O, (char *)"svm_parameter_weight_label_get(self) -> VectorOfInt32"},
	 { (char *)"svm_parameter_weight_set", _wrap_svm_parameter_weight_set, METH_VARARGS, (char *)"svm_parameter_weight_set(self, weight)"},
	 { (char *)"svm_parameter_weight_get", (PyCFunction)_wrap_svm_parameter_weight_get, METH_O, (char *)"svm_parameter_weight_get(self) -> FloatVector"},
	 { (char *)"svm_parameter_persistent_size", (PyCFunction)_wrap_svm_parameter_persistent_size, METH_O, (char *)"svm_parameter_persistent_size(self) -> int"},
	 { (char *)"svm_parameter_save", (PyCFunction) _wrap_svm_parameter_save, METH_VARARGS | METH_KEYWORDS, (char *)"svm_parameter_save(self, outStream)"},
	 { (char *)"svm_parameter_load", (PyCFunction) _wrap_svm_parameter_load, METH_VARARGS | METH_KEYWORDS, (char *)"svm_parameter_load(self, inStream)"},
	 { (char *)"delete_svm_parameter", (PyCFunction)_wrap_delete_svm_parameter, METH_O, (char *)"delete_svm_parameter(self)"},
	 { (char *)"svm_parameter_swigregister", svm_parameter_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_svm_std_traits", (PyCFunction)_wrap_new_svm_std_traits, METH_NOARGS, (char *)"new_svm_std_traits() -> svm_std_traits"},
	 { (char *)"delete_svm_std_traits", (PyCFunction)_wrap_delete_svm_std_traits, METH_O, (char *)"delete_svm_std_traits(self)"},
	 { (char *)"svm_std_traits_swigregister", svm_std_traits_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_svm_01_traits", (PyCFunction)_wrap_new_svm_01_traits, METH_NOARGS, (char *)"new_svm_01_traits() -> svm_01_traits"},
	 { (char *)"delete_svm_01_traits", (PyCFunction)_wrap_delete_svm_01_traits, METH_O, (char *)"delete_svm_01_traits(self)"},
	 { (char *)"svm_01_traits_swigregister", svm_01_traits_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_svm_dense", (PyCFunction) _wrap_new_svm_dense, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"new_svm_dense(kernel=0, n_dims=0, threshold=.9, cache_size=100, shrinking=1, probability=False, \n"
		"    seed=-1) -> svm_dense\n"
		""},
	 { (char *)"svm_dense_train", (PyCFunction) _wrap_svm_dense_train, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_train(self, gamma, C, eps)"},
	 { (char *)"svm_dense_get_problem", (PyCFunction)_wrap_svm_dense_get_problem, METH_O, (char *)"svm_dense_get_problem(self) -> svm_problem"},
	 { (char *)"svm_dense_get_model", (PyCFunction)_wrap_svm_dense_get_model, METH_O, (char *)"svm_dense_get_model(self) -> svm_model"},
	 { (char *)"svm_dense_discard_problem", (PyCFunction)_wrap_svm_dense_discard_problem, METH_O, (char *)"svm_dense_discard_problem(self)"},
	 { (char *)"svm_dense_cross_validation", (PyCFunction) _wrap_svm_dense_cross_validation, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_cross_validation(self, n_fold, gamma, C, eps) -> float"},
	 { (char *)"svm_dense_persistent_size", (PyCFunction)_wrap_svm_dense_persistent_size, METH_O, (char *)"svm_dense_persistent_size(self) -> int"},
	 { (char *)"svm_dense___getstate__", (PyCFunction)_wrap_svm_dense___getstate__, METH_O, (char *)"svm_dense___getstate__(self) -> PyObject *"},
	 { (char *)"svm_dense_loadFromString", (PyCFunction) _wrap_svm_dense_loadFromString, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_loadFromString(self, inString)"},
	 { (char *)"svm_dense_add_sample", (PyCFunction) _wrap_svm_dense_add_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_add_sample(self, y_val, x_vector)"},
	 { (char *)"svm_dense_predict", (PyCFunction) _wrap_svm_dense_predict, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_predict(self, x_vector) -> float"},
	 { (char *)"svm_dense_predict_probability", (PyCFunction) _wrap_svm_dense_predict_probability, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_predict_probability(self, x_vector, proba_vector) -> float"},
	 { (char *)"svm_dense_save", _wrap_svm_dense_save, METH_VARARGS, (char *)"\n"
		"save(outStream)\n"
		"svm_dense_save(self, filename)\n"
		""},
	 { (char *)"svm_dense_load", _wrap_svm_dense_load, METH_VARARGS, (char *)"\n"
		"load(inStream)\n"
		"svm_dense_load(self, filename)\n"
		""},
	 { (char *)"svm_dense_cross_validate", (PyCFunction) _wrap_svm_dense_cross_validate, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_cross_validate(self, n_fold, gamma, C, eps) -> float"},
	 { (char *)"svm_dense_trainReleaseGIL", (PyCFunction) _wrap_svm_dense_trainReleaseGIL, METH_VARARGS | METH_KEYWORDS, (char *)"svm_dense_trainReleaseGIL(self, gamma, C, eps)"},
	 { (char *)"delete_svm_dense", (PyCFunction)_wrap_delete_svm_dense, METH_O, (char *)"delete_svm_dense(self)"},
	 { (char *)"svm_dense_swigregister", svm_dense_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_svm_01", (PyCFunction) _wrap_new_svm_01, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"new_svm_01(kernel=0, n_dims=0, threshold=.9, cache_size=100, shrinking=1, probability=False, \n"
		"    seed=-1) -> svm_01\n"
		""},
	 { (char *)"svm_01_train", (PyCFunction) _wrap_svm_01_train, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_train(self, gamma, C, eps)"},
	 { (char *)"svm_01_get_problem", (PyCFunction)_wrap_svm_01_get_problem, METH_O, (char *)"svm_01_get_problem(self) -> svm_problem01"},
	 { (char *)"svm_01_get_model", (PyCFunction)_wrap_svm_01_get_model, METH_O, (char *)"svm_01_get_model(self) -> svm_model"},
	 { (char *)"svm_01_discard_problem", (PyCFunction)_wrap_svm_01_discard_problem, METH_O, (char *)"svm_01_discard_problem(self)"},
	 { (char *)"svm_01_cross_validation", (PyCFunction) _wrap_svm_01_cross_validation, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_cross_validation(self, n_fold, gamma, C, eps) -> float"},
	 { (char *)"svm_01_persistent_size", (PyCFunction)_wrap_svm_01_persistent_size, METH_O, (char *)"svm_01_persistent_size(self) -> int"},
	 { (char *)"svm_01___getstate__", (PyCFunction)_wrap_svm_01___getstate__, METH_O, (char *)"svm_01___getstate__(self) -> PyObject *"},
	 { (char *)"svm_01_loadFromString", (PyCFunction) _wrap_svm_01_loadFromString, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_loadFromString(self, inString)"},
	 { (char *)"svm_01_add_sample", (PyCFunction) _wrap_svm_01_add_sample, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_add_sample(self, y_val, x_vector)"},
	 { (char *)"svm_01_predict", (PyCFunction) _wrap_svm_01_predict, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_predict(self, x_vector) -> float"},
	 { (char *)"svm_01_predict_probability", (PyCFunction) _wrap_svm_01_predict_probability, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_predict_probability(self, x_vector, proba_vector) -> float"},
	 { (char *)"svm_01_cross_validate", (PyCFunction) _wrap_svm_01_cross_validate, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_cross_validate(self, n_fold, gamma, C, eps) -> float"},
	 { (char *)"svm_01_trainReleaseGIL", (PyCFunction) _wrap_svm_01_trainReleaseGIL, METH_VARARGS | METH_KEYWORDS, (char *)"svm_01_trainReleaseGIL(self, gamma, C, eps)"},
	 { (char *)"svm_01_save", _wrap_svm_01_save, METH_VARARGS, (char *)"\n"
		"save(outStream)\n"
		"svm_01_save(self, filename)\n"
		""},
	 { (char *)"svm_01_load", _wrap_svm_01_load, METH_VARARGS, (char *)"\n"
		"load(inStream)\n"
		"svm_01_load(self, filename)\n"
		""},
	 { (char *)"delete_svm_01", (PyCFunction)_wrap_delete_svm_01, METH_O, (char *)"delete_svm_01(self)"},
	 { (char *)"svm_01_swigregister", svm_01_swigregister, METH_VARARGS, NULL},
	 { (char *)"Float32SeparableConvolution2D_nrows__set", _wrap_Float32SeparableConvolution2D_nrows__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_nrows__set(self, nrows_)"},
	 { (char *)"Float32SeparableConvolution2D_nrows__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_nrows__get, METH_O, (char *)"Float32SeparableConvolution2D_nrows__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_ncols__set", _wrap_Float32SeparableConvolution2D_ncols__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_ncols__set(self, ncols_)"},
	 { (char *)"Float32SeparableConvolution2D_ncols__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_ncols__get, METH_O, (char *)"Float32SeparableConvolution2D_ncols__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f1_size__set", _wrap_Float32SeparableConvolution2D_f1_size__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f1_size__set(self, f1_size_)"},
	 { (char *)"Float32SeparableConvolution2D_f1_size__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f1_size__get, METH_O, (char *)"Float32SeparableConvolution2D_f1_size__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f2_size__set", _wrap_Float32SeparableConvolution2D_f2_size__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f2_size__set(self, f2_size_)"},
	 { (char *)"Float32SeparableConvolution2D_f2_size__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f2_size__get, METH_O, (char *)"Float32SeparableConvolution2D_f2_size__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f1_end_j__set", _wrap_Float32SeparableConvolution2D_f1_end_j__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f1_end_j__set(self, f1_end_j_)"},
	 { (char *)"Float32SeparableConvolution2D_f1_end_j__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f1_end_j__get, METH_O, (char *)"Float32SeparableConvolution2D_f1_end_j__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f2_end_i__set", _wrap_Float32SeparableConvolution2D_f2_end_i__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f2_end_i__set(self, f2_end_i_)"},
	 { (char *)"Float32SeparableConvolution2D_f2_end_i__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f2_end_i__get, METH_O, (char *)"Float32SeparableConvolution2D_f2_end_i__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f1_middle__set", _wrap_Float32SeparableConvolution2D_f1_middle__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f1_middle__set(self, f1_middle_)"},
	 { (char *)"Float32SeparableConvolution2D_f1_middle__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f1_middle__get, METH_O, (char *)"Float32SeparableConvolution2D_f1_middle__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f2_middle__set", _wrap_Float32SeparableConvolution2D_f2_middle__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f2_middle__set(self, f2_middle_)"},
	 { (char *)"Float32SeparableConvolution2D_f2_middle__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f2_middle__get, METH_O, (char *)"Float32SeparableConvolution2D_f2_middle__get(self) -> SeparableConvolution2D< float >::size_type"},
	 { (char *)"Float32SeparableConvolution2D_f1__set", _wrap_Float32SeparableConvolution2D_f1__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f1__set(self, f1_)"},
	 { (char *)"Float32SeparableConvolution2D_f1__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f1__get, METH_O, (char *)"Float32SeparableConvolution2D_f1__get(self) -> float *"},
	 { (char *)"Float32SeparableConvolution2D_f2__set", _wrap_Float32SeparableConvolution2D_f2__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f2__set(self, f2_)"},
	 { (char *)"Float32SeparableConvolution2D_f2__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f2__get, METH_O, (char *)"Float32SeparableConvolution2D_f2__get(self) -> float *"},
	 { (char *)"Float32SeparableConvolution2D_f1_end__set", _wrap_Float32SeparableConvolution2D_f1_end__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f1_end__set(self, f1_end_)"},
	 { (char *)"Float32SeparableConvolution2D_f1_end__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f1_end__get, METH_O, (char *)"Float32SeparableConvolution2D_f1_end__get(self) -> float *"},
	 { (char *)"Float32SeparableConvolution2D_f2_end__set", _wrap_Float32SeparableConvolution2D_f2_end__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_f2_end__set(self, f2_end_)"},
	 { (char *)"Float32SeparableConvolution2D_f2_end__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_f2_end__get, METH_O, (char *)"Float32SeparableConvolution2D_f2_end__get(self) -> float *"},
	 { (char *)"Float32SeparableConvolution2D_buffer__set", _wrap_Float32SeparableConvolution2D_buffer__set, METH_VARARGS, (char *)"Float32SeparableConvolution2D_buffer__set(self, buffer_)"},
	 { (char *)"Float32SeparableConvolution2D_buffer__get", (PyCFunction)_wrap_Float32SeparableConvolution2D_buffer__get, METH_O, (char *)"Float32SeparableConvolution2D_buffer__get(self) -> float *"},
	 { (char *)"new_Float32SeparableConvolution2D", (PyCFunction)_wrap_new_Float32SeparableConvolution2D, METH_NOARGS, (char *)"new_Float32SeparableConvolution2D() -> Float32SeparableConvolution2D"},
	 { (char *)"delete_Float32SeparableConvolution2D", (PyCFunction)_wrap_delete_Float32SeparableConvolution2D, METH_O, (char *)"delete_Float32SeparableConvolution2D(self)"},
	 { (char *)"Float32SeparableConvolution2D_init", _wrap_Float32SeparableConvolution2D_init, METH_VARARGS, (char *)"\n"
		"init(nrows, ncols, f1_size, f2_size, f1, f2)\n"
		"Float32SeparableConvolution2D_init(self, nrows, ncols, f1_size, f2_size, pyF1, pyF2)\n"
		""},
	 { (char *)"Float32SeparableConvolution2D_compute", _wrap_Float32SeparableConvolution2D_compute, METH_VARARGS, (char *)"\n"
		"compute(data, convolved, rotated45=False)\n"
		"Float32SeparableConvolution2D_compute(self, pyData, pyConvolved, rotated45=False)\n"
		""},
	 { (char *)"Float32SeparableConvolution2D_getBuffer", (PyCFunction) _wrap_Float32SeparableConvolution2D_getBuffer, METH_VARARGS | METH_KEYWORDS, (char *)"Float32SeparableConvolution2D_getBuffer(self, pyBuffer)"},
	 { (char *)"Float32SeparableConvolution2D_swigregister", Float32SeparableConvolution2D_swigregister, METH_VARARGS, NULL},
	 { (char *)"Float32Rotation45_srow__set", _wrap_Float32Rotation45_srow__set, METH_VARARGS, (char *)"Float32Rotation45_srow__set(self, srow_)"},
	 { (char *)"Float32Rotation45_srow__get", (PyCFunction)_wrap_Float32Rotation45_srow__get, METH_O, (char *)"Float32Rotation45_srow__get(self) -> int"},
	 { (char *)"Float32Rotation45_scol__set", _wrap_Float32Rotation45_scol__set, METH_VARARGS, (char *)"Float32Rotation45_scol__set(self, scol_)"},
	 { (char *)"Float32Rotation45_scol__get", (PyCFunction)_wrap_Float32Rotation45_scol__get, METH_O, (char *)"Float32Rotation45_scol__get(self) -> int"},
	 { (char *)"Float32Rotation45_offset__set", _wrap_Float32Rotation45_offset__set, METH_VARARGS, (char *)"Float32Rotation45_offset__set(self, offset_)"},
	 { (char *)"Float32Rotation45_offset__get", (PyCFunction)_wrap_Float32Rotation45_offset__get, METH_O, (char *)"Float32Rotation45_offset__get(self) -> size_t"},
	 { (char *)"Float32Rotation45_round", (PyCFunction) _wrap_Float32Rotation45_round, METH_VARARGS | METH_KEYWORDS, (char *)"Float32Rotation45_round(self, x) -> float"},
	 { (char *)"Float32Rotation45_rotate", _wrap_Float32Rotation45_rotate, METH_VARARGS, (char *)"\n"
		"rotate(original, rotated, nrows, ncols, z)\n"
		"Float32Rotation45_rotate(self, pyOriginal, pyRotated, nrows, ncols, z)\n"
		""},
	 { (char *)"Float32Rotation45_unrotate", _wrap_Float32Rotation45_unrotate, METH_VARARGS, (char *)"\n"
		"unrotate(unrotated, rotated, nrows, ncols, z)\n"
		"Float32Rotation45_unrotate(self, pyUnrotated, pyRotated, nrows, ncols, z)\n"
		""},
	 { (char *)"new_Float32Rotation45", (PyCFunction)_wrap_new_Float32Rotation45, METH_NOARGS, (char *)"new_Float32Rotation45() -> Float32Rotation45"},
	 { (char *)"delete_Float32Rotation45", (PyCFunction)_wrap_delete_Float32Rotation45, METH_O, (char *)"delete_Float32Rotation45(self)"},
	 { (char *)"Float32Rotation45_swigregister", Float32Rotation45_swigregister, METH_VARARGS, NULL},
	 { (char *)"Float32Erosion_nrows__set", _wrap_Float32Erosion_nrows__set, METH_VARARGS, (char *)"Float32Erosion_nrows__set(self, nrows_)"},
	 { (char *)"Float32Erosion_nrows__get", (PyCFunction)_wrap_Float32Erosion_nrows__get, METH_O, (char *)"Float32Erosion_nrows__get(self) -> Erosion< float >::size_type"},
	 { (char *)"Float32Erosion_ncols__set", _wrap_Float32Erosion_ncols__set, METH_VARARGS, (char *)"Float32Erosion_ncols__set(self, ncols_)"},
	 { (char *)"Float32Erosion_ncols__get", (PyCFunction)_wrap_Float32Erosion_ncols__get, METH_O, (char *)"Float32Erosion_ncols__get(self) -> Erosion< float >::size_type"},
	 { (char *)"Float32Erosion_buffer__set", _wrap_Float32Erosion_buffer__set, METH_VARARGS, (char *)"Float32Erosion_buffer__set(self, buffer_)"},
	 { (char *)"Float32Erosion_buffer__get", (PyCFunction)_wrap_Float32Erosion_buffer__get, METH_O, (char *)"Float32Erosion_buffer__get(self) -> float *"},
	 { (char *)"new_Float32Erosion", (PyCFunction)_wrap_new_Float32Erosion, METH_NOARGS, (char *)"new_Float32Erosion() -> Float32Erosion"},
	 { (char *)"delete_Float32Erosion", (PyCFunction)_wrap_delete_Float32Erosion, METH_O, (char *)"delete_Float32Erosion(self)"},
	 { (char *)"Float32Erosion_init", _wrap_Float32Erosion_init, METH_VARARGS, (char *)"\n"
		"init(nrows, ncols)\n"
		"Float32Erosion_init(self, nrows, ncols)\n"
		""},
	 { (char *)"Float32Erosion_compute", _wrap_Float32Erosion_compute, METH_VARARGS, (char *)"\n"
		"compute(data, eroded, iterations, dilate=False)\n"
		"Float32Erosion_compute(self, pyData, pyEroded, iterations, dilate=False)\n"
		""},
	 { (char *)"Float32Erosion_getBuffer", (PyCFunction) _wrap_Float32Erosion_getBuffer, METH_VARARGS | METH_KEYWORDS, (char *)"Float32Erosion_getBuffer(self, pyBuffer)"},
	 { (char *)"Float32Erosion_swigregister", Float32Erosion_swigregister, METH_VARARGS, NULL},
	 { (char *)"computeAlpha", _wrap_computeAlpha, METH_VARARGS, (char *)"\n"
		"computeAlpha(xstep, ystep, widthS, heightS, imageWidth, imageHeight, xcount, ycount, weightWidth, \n"
		"    sharpness, data, values, counts, weights)\n"
		"computeAlpha(xstep, ystep, widthS, heightS, imageWidth, imageHeight, xcount, ycount, weightWidth, \n"
		"    sharpness, pyData, pyValues, pyCounts, pyWeights)\n"
		""},
	 { (char *)"Byte_Vector_iterator", (PyCFunction)_wrap_Byte_Vector_iterator, METH_O, (char *)"Byte_Vector_iterator(self) -> SwigPyIterator"},
	 { (char *)"Byte_Vector___nonzero__", (PyCFunction)_wrap_Byte_Vector___nonzero__, METH_O, (char *)"Byte_Vector___nonzero__(self) -> bool"},
	 { (char *)"Byte_Vector___bool__", (PyCFunction)_wrap_Byte_Vector___bool__, METH_O, (char *)"Byte_Vector___bool__(self) -> bool"},
	 { (char *)"Byte_Vector___len__", (PyCFunction)_wrap_Byte_Vector___len__, METH_O, (char *)"Byte_Vector___len__(self) -> std::vector< char >::size_type"},
	 { (char *)"Byte_Vector_pop", (PyCFunction)_wrap_Byte_Vector_pop, METH_O, (char *)"Byte_Vector_pop(self) -> std::vector< char >::value_type"},
	 { (char *)"Byte_Vector___getslice__", (PyCFunction) _wrap_Byte_Vector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector___getslice__(self, i, j) -> Byte_Vector"},
	 { (char *)"Byte_Vector___setslice__", (PyCFunction) _wrap_Byte_Vector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector___setslice__(self, i, j, v=std::vector< char,std::allocator< char > >())"},
	 { (char *)"Byte_Vector___delslice__", (PyCFunction) _wrap_Byte_Vector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector___delslice__(self, i, j)"},
	 { (char *)"Byte_Vector___delitem__", _wrap_Byte_Vector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"Byte_Vector___delitem__(self, slice)\n"
		""},
	 { (char *)"Byte_Vector___getitem__", _wrap_Byte_Vector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> Byte_Vector\n"
		"Byte_Vector___getitem__(self, i) -> std::vector< char >::value_type const &\n"
		""},
	 { (char *)"Byte_Vector___setitem__", _wrap_Byte_Vector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"Byte_Vector___setitem__(self, i, x)\n"
		""},
	 { (char *)"Byte_Vector_append", (PyCFunction) _wrap_Byte_Vector_append, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector_append(self, x)"},
	 { (char *)"Byte_Vector_empty", (PyCFunction)_wrap_Byte_Vector_empty, METH_O, (char *)"Byte_Vector_empty(self) -> bool"},
	 { (char *)"Byte_Vector_size", (PyCFunction)_wrap_Byte_Vector_size, METH_O, (char *)"Byte_Vector_size(self) -> std::vector< char >::size_type"},
	 { (char *)"Byte_Vector_clear", (PyCFunction)_wrap_Byte_Vector_clear, METH_O, (char *)"Byte_Vector_clear(self)"},
	 { (char *)"Byte_Vector_swap", (PyCFunction) _wrap_Byte_Vector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector_swap(self, v)"},
	 { (char *)"Byte_Vector_get_allocator", (PyCFunction)_wrap_Byte_Vector_get_allocator, METH_O, (char *)"Byte_Vector_get_allocator(self) -> std::vector< char >::allocator_type"},
	 { (char *)"Byte_Vector_begin", (PyCFunction)_wrap_Byte_Vector_begin, METH_O, (char *)"Byte_Vector_begin(self) -> std::vector< char >::iterator"},
	 { (char *)"Byte_Vector_end", (PyCFunction)_wrap_Byte_Vector_end, METH_O, (char *)"Byte_Vector_end(self) -> std::vector< char >::iterator"},
	 { (char *)"Byte_Vector_rbegin", (PyCFunction)_wrap_Byte_Vector_rbegin, METH_O, (char *)"Byte_Vector_rbegin(self) -> std::vector< char >::reverse_iterator"},
	 { (char *)"Byte_Vector_rend", (PyCFunction)_wrap_Byte_Vector_rend, METH_O, (char *)"Byte_Vector_rend(self) -> std::vector< char >::reverse_iterator"},
	 { (char *)"Byte_Vector_pop_back", (PyCFunction)_wrap_Byte_Vector_pop_back, METH_O, (char *)"Byte_Vector_pop_back(self)"},
	 { (char *)"Byte_Vector_erase", _wrap_Byte_Vector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< char >::iterator\n"
		"Byte_Vector_erase(self, first, last) -> std::vector< char >::iterator\n"
		""},
	 { (char *)"new_Byte_Vector", _wrap_new_Byte_Vector, METH_VARARGS, (char *)"\n"
		"Byte_Vector()\n"
		"Byte_Vector(arg2)\n"
		"Byte_Vector(size)\n"
		"new_Byte_Vector(size, value) -> Byte_Vector\n"
		""},
	 { (char *)"Byte_Vector_push_back", (PyCFunction) _wrap_Byte_Vector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector_push_back(self, x)"},
	 { (char *)"Byte_Vector_front", (PyCFunction)_wrap_Byte_Vector_front, METH_O, (char *)"Byte_Vector_front(self) -> std::vector< char >::value_type const &"},
	 { (char *)"Byte_Vector_back", (PyCFunction)_wrap_Byte_Vector_back, METH_O, (char *)"Byte_Vector_back(self) -> std::vector< char >::value_type const &"},
	 { (char *)"Byte_Vector_assign", (PyCFunction) _wrap_Byte_Vector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector_assign(self, n, x)"},
	 { (char *)"Byte_Vector_resize", _wrap_Byte_Vector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"Byte_Vector_resize(self, new_size, x)\n"
		""},
	 { (char *)"Byte_Vector_insert", _wrap_Byte_Vector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< char >::iterator\n"
		"Byte_Vector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"Byte_Vector_reserve", (PyCFunction) _wrap_Byte_Vector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"Byte_Vector_reserve(self, n)"},
	 { (char *)"Byte_Vector_capacity", (PyCFunction)_wrap_Byte_Vector_capacity, METH_O, (char *)"Byte_Vector_capacity(self) -> std::vector< char >::size_type"},
	 { (char *)"delete_Byte_Vector", (PyCFunction)_wrap_delete_Byte_Vector, METH_O, (char *)"delete_Byte_Vector(self)"},
	 { (char *)"Byte_Vector_swigregister", Byte_Vector_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_ByteVector", (PyCFunction) _wrap_new_ByteVector, METH_VARARGS | METH_KEYWORDS, (char *)"new_ByteVector(n=0) -> ByteVector"},
	 { (char *)"delete_ByteVector", (PyCFunction)_wrap_delete_ByteVector, METH_O, (char *)"delete_ByteVector(self)"},
	 { (char *)"ByteVector_swigregister", ByteVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"Size_T_Vector_iterator", (PyCFunction)_wrap_Size_T_Vector_iterator, METH_O, (char *)"Size_T_Vector_iterator(self) -> SwigPyIterator"},
	 { (char *)"Size_T_Vector___nonzero__", (PyCFunction)_wrap_Size_T_Vector___nonzero__, METH_O, (char *)"Size_T_Vector___nonzero__(self) -> bool"},
	 { (char *)"Size_T_Vector___bool__", (PyCFunction)_wrap_Size_T_Vector___bool__, METH_O, (char *)"Size_T_Vector___bool__(self) -> bool"},
	 { (char *)"Size_T_Vector___len__", (PyCFunction)_wrap_Size_T_Vector___len__, METH_O, (char *)"Size_T_Vector___len__(self) -> std::vector< size_t >::size_type"},
	 { (char *)"Size_T_Vector_pop", (PyCFunction)_wrap_Size_T_Vector_pop, METH_O, (char *)"Size_T_Vector_pop(self) -> std::vector< size_t >::value_type"},
	 { (char *)"Size_T_Vector___getslice__", (PyCFunction) _wrap_Size_T_Vector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector___getslice__(self, i, j) -> Size_T_Vector"},
	 { (char *)"Size_T_Vector___setslice__", (PyCFunction) _wrap_Size_T_Vector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector___setslice__(self, i, j, v=std::vector< size_t,std::allocator< size_t > >())"},
	 { (char *)"Size_T_Vector___delslice__", (PyCFunction) _wrap_Size_T_Vector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector___delslice__(self, i, j)"},
	 { (char *)"Size_T_Vector___delitem__", _wrap_Size_T_Vector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"Size_T_Vector___delitem__(self, slice)\n"
		""},
	 { (char *)"Size_T_Vector___getitem__", _wrap_Size_T_Vector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> Size_T_Vector\n"
		"Size_T_Vector___getitem__(self, i) -> std::vector< size_t >::value_type const &\n"
		""},
	 { (char *)"Size_T_Vector___setitem__", _wrap_Size_T_Vector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"Size_T_Vector___setitem__(self, i, x)\n"
		""},
	 { (char *)"Size_T_Vector_append", (PyCFunction) _wrap_Size_T_Vector_append, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector_append(self, x)"},
	 { (char *)"Size_T_Vector_empty", (PyCFunction)_wrap_Size_T_Vector_empty, METH_O, (char *)"Size_T_Vector_empty(self) -> bool"},
	 { (char *)"Size_T_Vector_size", (PyCFunction)_wrap_Size_T_Vector_size, METH_O, (char *)"Size_T_Vector_size(self) -> std::vector< size_t >::size_type"},
	 { (char *)"Size_T_Vector_clear", (PyCFunction)_wrap_Size_T_Vector_clear, METH_O, (char *)"Size_T_Vector_clear(self)"},
	 { (char *)"Size_T_Vector_swap", (PyCFunction) _wrap_Size_T_Vector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector_swap(self, v)"},
	 { (char *)"Size_T_Vector_get_allocator", (PyCFunction)_wrap_Size_T_Vector_get_allocator, METH_O, (char *)"Size_T_Vector_get_allocator(self) -> std::vector< size_t >::allocator_type"},
	 { (char *)"Size_T_Vector_begin", (PyCFunction)_wrap_Size_T_Vector_begin, METH_O, (char *)"Size_T_Vector_begin(self) -> std::vector< size_t >::iterator"},
	 { (char *)"Size_T_Vector_end", (PyCFunction)_wrap_Size_T_Vector_end, METH_O, (char *)"Size_T_Vector_end(self) -> std::vector< size_t >::iterator"},
	 { (char *)"Size_T_Vector_rbegin", (PyCFunction)_wrap_Size_T_Vector_rbegin, METH_O, (char *)"Size_T_Vector_rbegin(self) -> std::vector< size_t >::reverse_iterator"},
	 { (char *)"Size_T_Vector_rend", (PyCFunction)_wrap_Size_T_Vector_rend, METH_O, (char *)"Size_T_Vector_rend(self) -> std::vector< size_t >::reverse_iterator"},
	 { (char *)"Size_T_Vector_pop_back", (PyCFunction)_wrap_Size_T_Vector_pop_back, METH_O, (char *)"Size_T_Vector_pop_back(self)"},
	 { (char *)"Size_T_Vector_erase", _wrap_Size_T_Vector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> std::vector< size_t >::iterator\n"
		"Size_T_Vector_erase(self, first, last) -> std::vector< size_t >::iterator\n"
		""},
	 { (char *)"new_Size_T_Vector", _wrap_new_Size_T_Vector, METH_VARARGS, (char *)"\n"
		"Size_T_Vector()\n"
		"Size_T_Vector(arg2)\n"
		"Size_T_Vector(size)\n"
		"new_Size_T_Vector(size, value) -> Size_T_Vector\n"
		""},
	 { (char *)"Size_T_Vector_push_back", (PyCFunction) _wrap_Size_T_Vector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector_push_back(self, x)"},
	 { (char *)"Size_T_Vector_front", (PyCFunction)_wrap_Size_T_Vector_front, METH_O, (char *)"Size_T_Vector_front(self) -> std::vector< size_t >::value_type const &"},
	 { (char *)"Size_T_Vector_back", (PyCFunction)_wrap_Size_T_Vector_back, METH_O, (char *)"Size_T_Vector_back(self) -> std::vector< size_t >::value_type const &"},
	 { (char *)"Size_T_Vector_assign", (PyCFunction) _wrap_Size_T_Vector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector_assign(self, n, x)"},
	 { (char *)"Size_T_Vector_resize", _wrap_Size_T_Vector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"Size_T_Vector_resize(self, new_size, x)\n"
		""},
	 { (char *)"Size_T_Vector_insert", _wrap_Size_T_Vector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> std::vector< size_t >::iterator\n"
		"Size_T_Vector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"Size_T_Vector_reserve", (PyCFunction) _wrap_Size_T_Vector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"Size_T_Vector_reserve(self, n)"},
	 { (char *)"Size_T_Vector_capacity", (PyCFunction)_wrap_Size_T_Vector_capacity, METH_O, (char *)"Size_T_Vector_capacity(self) -> std::vector< size_t >::size_type"},
	 { (char *)"delete_Size_T_Vector", (PyCFunction)_wrap_delete_Size_T_Vector, METH_O, (char *)"delete_Size_T_Vector(self)"},
	 { (char *)"Size_T_Vector_swigregister", Size_T_Vector_swigregister, METH_VARARGS, NULL},
	 { (char *)"non_zeros_ui8", (PyCFunction) _wrap_non_zeros_ui8, METH_VARARGS | METH_KEYWORDS, (char *)"non_zeros_ui8(py_x, py_y) -> nupic::UInt32"},
	 { (char *)"non_zeros_i32", (PyCFunction) _wrap_non_zeros_i32, METH_VARARGS | METH_KEYWORDS, (char *)"non_zeros_i32(py_x, py_y) -> nupic::UInt32"},
	 { (char *)"non_zeros_f32", (PyCFunction) _wrap_non_zeros_f32, METH_VARARGS | METH_KEYWORDS, (char *)"non_zeros_f32(py_x, py_y) -> nupic::UInt32"},
	 { (char *)"rightVecProdAtIndices", (PyCFunction) _wrap_rightVecProdAtIndices, METH_VARARGS | METH_KEYWORDS, (char *)"rightVecProdAtIndices(py_ind, py_x, py_y)"},
	 { (char *)"generate2DGaussianSample", (PyCFunction) _wrap_generate2DGaussianSample, METH_VARARGS | METH_KEYWORDS, (char *)"generate2DGaussianSample(nrows, ncols, nnzpr, rf_x, sigma, seed=-1, sorted=True) -> PyObject *"},
	 { (char *)"getSegmentActivityLevel", (PyCFunction) _wrap_getSegmentActivityLevel, METH_VARARGS | METH_KEYWORDS, (char *)"getSegmentActivityLevel(py_seg, py_state, connectedSynapsesOnly, connectedPerm) -> nupic::UInt32"},
	 { (char *)"isSegmentActive", (PyCFunction) _wrap_isSegmentActive, METH_VARARGS | METH_KEYWORDS, (char *)"isSegmentActive(py_seg, py_state, connectedPerm, activationThreshold) -> bool"},
	 { (char *)"new_CState", (PyCFunction)_wrap_new_CState, METH_NOARGS, (char *)"new_CState() -> CState"},
	 { (char *)"delete_CState", (PyCFunction)_wrap_delete_CState, METH_O, (char *)"delete_CState(self)"},
	 { (char *)"CState_initialize", (PyCFunction) _wrap_CState_initialize, METH_VARARGS | METH_KEYWORDS, (char *)"CState_initialize(self, nCells) -> bool"},
	 { (char *)"CState_usePythonMemory", (PyCFunction) _wrap_CState_usePythonMemory, METH_VARARGS | METH_KEYWORDS, (char *)"CState_usePythonMemory(self, pData, nCells)"},
	 { (char *)"CState_isSet", (PyCFunction) _wrap_CState_isSet, METH_VARARGS | METH_KEYWORDS, (char *)"CState_isSet(self, cellIdx) -> bool"},
	 { (char *)"CState_set", (PyCFunction) _wrap_CState_set, METH_VARARGS | METH_KEYWORDS, (char *)"CState_set(self, cellIdx)"},
	 { (char *)"CState_resetAll", (PyCFunction)_wrap_CState_resetAll, METH_O, (char *)"CState_resetAll(self)"},
	 { (char *)"CState_arrayPtr", (PyCFunction)_wrap_CState_arrayPtr, METH_O, (char *)"CState_arrayPtr(self) -> nupic::Byte *"},
	 { (char *)"CState_load", (PyCFunction) _wrap_CState_load, METH_VARARGS | METH_KEYWORDS, (char *)"CState_load(self, inStream)"},
	 { (char *)"CState_version", (PyCFunction)_wrap_CState_version, METH_O, (char *)"CState_version(self) -> nupic::UInt"},
	 { (char *)"CState_swigregister", CState_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_CStateIndexed", (PyCFunction)_wrap_new_CStateIndexed, METH_NOARGS, (char *)"new_CStateIndexed() -> CStateIndexed"},
	 { (char *)"CStateIndexed_cellsOn", (PyCFunction) _wrap_CStateIndexed_cellsOn, METH_VARARGS | METH_KEYWORDS, (char *)"CStateIndexed_cellsOn(self, fSorted=False) -> VectorOfUInt32"},
	 { (char *)"CStateIndexed_set", (PyCFunction) _wrap_CStateIndexed_set, METH_VARARGS | METH_KEYWORDS, (char *)"CStateIndexed_set(self, cellIdx)"},
	 { (char *)"CStateIndexed_resetAll", (PyCFunction)_wrap_CStateIndexed_resetAll, METH_O, (char *)"CStateIndexed_resetAll(self)"},
	 { (char *)"CStateIndexed_load", (PyCFunction) _wrap_CStateIndexed_load, METH_VARARGS | METH_KEYWORDS, (char *)"CStateIndexed_load(self, inStream)"},
	 { (char *)"CStateIndexed_version", (PyCFunction)_wrap_CStateIndexed_version, METH_O, (char *)"CStateIndexed_version(self) -> nupic::UInt"},
	 { (char *)"delete_CStateIndexed", (PyCFunction)_wrap_delete_CStateIndexed, METH_O, (char *)"delete_CStateIndexed(self)"},
	 { (char *)"CStateIndexed_swigregister", CStateIndexed_swigregister, METH_VARARGS, NULL},
	 { (char *)"InSynapseOrder___call__", (PyCFunction) _wrap_InSynapseOrder___call__, METH_VARARGS | METH_KEYWORDS, (char *)"InSynapseOrder___call__(self, a, b) -> bool"},
	 { (char *)"new_InSynapseOrder", (PyCFunction)_wrap_new_InSynapseOrder, METH_NOARGS, (char *)"new_InSynapseOrder() -> InSynapseOrder"},
	 { (char *)"delete_InSynapseOrder", (PyCFunction)_wrap_delete_InSynapseOrder, METH_O, (char *)"delete_InSynapseOrder(self)"},
	 { (char *)"InSynapseOrder_swigregister", InSynapseOrder_swigregister, METH_VARARGS, NULL},
	 { (char *)"Segment__totalActivations_set", _wrap_Segment__totalActivations_set, METH_VARARGS, (char *)"Segment__totalActivations_set(self, _totalActivations)"},
	 { (char *)"Segment__totalActivations_get", (PyCFunction)_wrap_Segment__totalActivations_get, METH_O, (char *)"Segment__totalActivations_get(self) -> nupic::UInt"},
	 { (char *)"Segment__positiveActivations_set", _wrap_Segment__positiveActivations_set, METH_VARARGS, (char *)"Segment__positiveActivations_set(self, _positiveActivations)"},
	 { (char *)"Segment__positiveActivations_get", (PyCFunction)_wrap_Segment__positiveActivations_get, METH_O, (char *)"Segment__positiveActivations_get(self) -> nupic::UInt"},
	 { (char *)"Segment__lastActiveIteration_set", _wrap_Segment__lastActiveIteration_set, METH_VARARGS, (char *)"Segment__lastActiveIteration_set(self, _lastActiveIteration)"},
	 { (char *)"Segment__lastActiveIteration_get", (PyCFunction)_wrap_Segment__lastActiveIteration_get, METH_O, (char *)"Segment__lastActiveIteration_get(self) -> nupic::UInt"},
	 { (char *)"Segment__lastPosDutyCycle_set", _wrap_Segment__lastPosDutyCycle_set, METH_VARARGS, (char *)"Segment__lastPosDutyCycle_set(self, _lastPosDutyCycle)"},
	 { (char *)"Segment__lastPosDutyCycle_get", (PyCFunction)_wrap_Segment__lastPosDutyCycle_get, METH_O, (char *)"Segment__lastPosDutyCycle_get(self) -> nupic::Real"},
	 { (char *)"Segment__lastPosDutyCycleIteration_set", _wrap_Segment__lastPosDutyCycleIteration_set, METH_VARARGS, (char *)"Segment__lastPosDutyCycleIteration_set(self, _lastPosDutyCycleIteration)"},
	 { (char *)"Segment__lastPosDutyCycleIteration_get", (PyCFunction)_wrap_Segment__lastPosDutyCycleIteration_get, METH_O, (char *)"Segment__lastPosDutyCycleIteration_get(self) -> nupic::UInt"},
	 { (char *)"new_Segment", _wrap_new_Segment, METH_VARARGS, (char *)"\n"
		"Segment()\n"
		"Segment(_s, frequency, seqSegFlag, permConnected, iteration)\n"
		"new_Segment(o) -> Segment\n"
		""},
	 { (char *)"Segment_invariants", (PyCFunction)_wrap_Segment_invariants, METH_O, (char *)"Segment_invariants(self) -> bool"},
	 { (char *)"Segment_checkConnected", (PyCFunction) _wrap_Segment_checkConnected, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_checkConnected(self, permConnected) -> bool"},
	 { (char *)"Segment_empty", (PyCFunction)_wrap_Segment_empty, METH_O, (char *)"Segment_empty(self) -> bool"},
	 { (char *)"Segment_size", (PyCFunction)_wrap_Segment_size, METH_O, (char *)"Segment_size(self) -> nupic::UInt"},
	 { (char *)"Segment_isSequenceSegment", (PyCFunction)_wrap_Segment_isSequenceSegment, METH_O, (char *)"Segment_isSequenceSegment(self) -> bool"},
	 { (char *)"Segment_frequency", (PyCFunction)_wrap_Segment_frequency, METH_O, (char *)"Segment_frequency(self) -> nupic::Real &"},
	 { (char *)"Segment_getFrequency", (PyCFunction)_wrap_Segment_getFrequency, METH_O, (char *)"Segment_getFrequency(self) -> nupic::Real"},
	 { (char *)"Segment_nConnected", (PyCFunction)_wrap_Segment_nConnected, METH_O, (char *)"Segment_nConnected(self) -> nupic::UInt"},
	 { (char *)"Segment_getTotalActivations", (PyCFunction)_wrap_Segment_getTotalActivations, METH_O, (char *)"Segment_getTotalActivations(self) -> nupic::UInt"},
	 { (char *)"Segment_getPositiveActivations", (PyCFunction)_wrap_Segment_getPositiveActivations, METH_O, (char *)"Segment_getPositiveActivations(self) -> nupic::UInt"},
	 { (char *)"Segment_getLastActiveIteration", (PyCFunction)_wrap_Segment_getLastActiveIteration, METH_O, (char *)"Segment_getLastActiveIteration(self) -> nupic::UInt"},
	 { (char *)"Segment_getLastPosDutyCycle", (PyCFunction)_wrap_Segment_getLastPosDutyCycle, METH_O, (char *)"Segment_getLastPosDutyCycle(self) -> nupic::Real"},
	 { (char *)"Segment_getLastPosDutyCycleIteration", (PyCFunction)_wrap_Segment_getLastPosDutyCycleIteration, METH_O, (char *)"Segment_getLastPosDutyCycleIteration(self) -> nupic::UInt"},
	 { (char *)"Segment_has", (PyCFunction) _wrap_Segment_has, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_has(self, srcCellIdx) -> bool"},
	 { (char *)"Segment_setPermanence", (PyCFunction) _wrap_Segment_setPermanence, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_setPermanence(self, idx, val)"},
	 { (char *)"Segment_getPermanence", (PyCFunction) _wrap_Segment_getPermanence, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_getPermanence(self, idx) -> nupic::Real"},
	 { (char *)"Segment_getSrcCellIdx", (PyCFunction) _wrap_Segment_getSrcCellIdx, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_getSrcCellIdx(self, idx) -> nupic::UInt"},
	 { (char *)"Segment_getSrcCellIndices", (PyCFunction) _wrap_Segment_getSrcCellIndices, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_getSrcCellIndices(self, srcCells)"},
	 { (char *)"Segment_clear", (PyCFunction)_wrap_Segment_clear, METH_O, (char *)"Segment_clear(self)"},
	 { (char *)"Segment_addSynapses", (PyCFunction) _wrap_Segment_addSynapses, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_addSynapses(self, srcCells, initStrength, permConnected)"},
	 { (char *)"Segment_recomputeConnected", (PyCFunction) _wrap_Segment_recomputeConnected, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_recomputeConnected(self, permConnected)"},
	 { (char *)"Segment_decaySynapses2", (PyCFunction) _wrap_Segment_decaySynapses2, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_decaySynapses2(self, decay, removed, permConnected)"},
	 { (char *)"Segment_decaySynapses", (PyCFunction) _wrap_Segment_decaySynapses, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_decaySynapses(self, decay, removed, permConnected, doDecay=True)"},
	 { (char *)"Segment_freeNSynapses", (PyCFunction) _wrap_Segment_freeNSynapses, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"Segment_freeNSynapses(self, numToFree, inactiveSynapseIndices, inactiveSegmentIndices, activeSynapseIndices, \n"
		"    activeSegmentIndices, removed, verbosity, nCellsPerCol, permMax)\n"
		""},
	 { (char *)"Segment_isActive", (PyCFunction) _wrap_Segment_isActive, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_isActive(self, activities, permConnected, activationThreshold) -> bool"},
	 { (char *)"Segment_computeActivity", (PyCFunction) _wrap_Segment_computeActivity, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_computeActivity(self, activities, permConnected, connectedSynapsesOnly) -> nupic::UInt"},
	 { (char *)"Segment_dutyCycle", (PyCFunction) _wrap_Segment_dutyCycle, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_dutyCycle(self, iteration, active, readOnly) -> nupic::Real"},
	 { (char *)"Segment_atDutyCycleTier", (PyCFunction) _wrap_Segment_atDutyCycleTier, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_atDutyCycleTier(iteration) -> bool"},
	 { (char *)"Segment_persistentSize", (PyCFunction)_wrap_Segment_persistentSize, METH_O, (char *)"Segment_persistentSize(self) -> nupic::UInt"},
	 { (char *)"Segment_save", (PyCFunction) _wrap_Segment_save, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_save(self, outStream)"},
	 { (char *)"Segment_load", (PyCFunction) _wrap_Segment_load, METH_VARARGS | METH_KEYWORDS, (char *)"Segment_load(self, inStream)"},
	 { (char *)"delete_Segment", (PyCFunction)_wrap_delete_Segment, METH_O, (char *)"delete_Segment(self)"},
	 { (char *)"Segment_swigregister", Segment_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_SegmentUpdate", _wrap_new_SegmentUpdate, METH_VARARGS, (char *)"\n"
		"SegmentUpdate()\n"
		"SegmentUpdate(cellIdx, segIdx, sequenceSegment, timeStamp, synapses=std::vector< nupic::UInt >(), \n"
		"    phase1Flag=False, weaklyPredicting=False, cells=None)\n"
		"new_SegmentUpdate(o) -> SegmentUpdate\n"
		""},
	 { (char *)"SegmentUpdate_isSequenceSegment", (PyCFunction)_wrap_SegmentUpdate_isSequenceSegment, METH_O, (char *)"SegmentUpdate_isSequenceSegment(self) -> bool"},
	 { (char *)"SegmentUpdate_cellIdx", (PyCFunction)_wrap_SegmentUpdate_cellIdx, METH_O, (char *)"SegmentUpdate_cellIdx(self) -> nupic::UInt"},
	 { (char *)"SegmentUpdate_segIdx", (PyCFunction)_wrap_SegmentUpdate_segIdx, METH_O, (char *)"SegmentUpdate_segIdx(self) -> nupic::UInt"},
	 { (char *)"SegmentUpdate_timeStamp", (PyCFunction)_wrap_SegmentUpdate_timeStamp, METH_O, (char *)"SegmentUpdate_timeStamp(self) -> nupic::UInt"},
	 { (char *)"SegmentUpdate_begin", (PyCFunction)_wrap_SegmentUpdate_begin, METH_O, (char *)"SegmentUpdate_begin(self) -> nupic::algorithms::Cells4::SegmentUpdate::const_iterator"},
	 { (char *)"SegmentUpdate_end", (PyCFunction)_wrap_SegmentUpdate_end, METH_O, (char *)"SegmentUpdate_end(self) -> nupic::algorithms::Cells4::SegmentUpdate::const_iterator"},
	 { (char *)"SegmentUpdate_size", (PyCFunction)_wrap_SegmentUpdate_size, METH_O, (char *)"SegmentUpdate_size(self) -> nupic::UInt"},
	 { (char *)"SegmentUpdate_empty", (PyCFunction)_wrap_SegmentUpdate_empty, METH_O, (char *)"SegmentUpdate_empty(self) -> bool"},
	 { (char *)"SegmentUpdate_isNewSegment", (PyCFunction)_wrap_SegmentUpdate_isNewSegment, METH_O, (char *)"SegmentUpdate_isNewSegment(self) -> bool"},
	 { (char *)"SegmentUpdate_isPhase1Segment", (PyCFunction)_wrap_SegmentUpdate_isPhase1Segment, METH_O, (char *)"SegmentUpdate_isPhase1Segment(self) -> bool"},
	 { (char *)"SegmentUpdate_isWeaklyPredicting", (PyCFunction)_wrap_SegmentUpdate_isWeaklyPredicting, METH_O, (char *)"SegmentUpdate_isWeaklyPredicting(self) -> bool"},
	 { (char *)"SegmentUpdate_invariants", (PyCFunction) _wrap_SegmentUpdate_invariants, METH_VARARGS | METH_KEYWORDS, (char *)"SegmentUpdate_invariants(self, cells=None) -> bool"},
	 { (char *)"SegmentUpdate_save", (PyCFunction) _wrap_SegmentUpdate_save, METH_VARARGS | METH_KEYWORDS, (char *)"SegmentUpdate_save(self, outStream)"},
	 { (char *)"SegmentUpdate_load", (PyCFunction) _wrap_SegmentUpdate_load, METH_VARARGS | METH_KEYWORDS, (char *)"SegmentUpdate_load(self, inStream)"},
	 { (char *)"delete_SegmentUpdate", (PyCFunction)_wrap_delete_SegmentUpdate, METH_O, (char *)"delete_SegmentUpdate(self)"},
	 { (char *)"SegmentUpdate_swigregister", SegmentUpdate_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_OutSynapse", _wrap_new_OutSynapse, METH_VARARGS, (char *)"\n"
		"OutSynapse(dstCellIdx=(UInt) -1, dstSegIdx=(UInt) -1)\n"
		"new_OutSynapse(o) -> OutSynapse\n"
		""},
	 { (char *)"OutSynapse_dstCellIdx", (PyCFunction)_wrap_OutSynapse_dstCellIdx, METH_O, (char *)"OutSynapse_dstCellIdx(self) -> nupic::UInt"},
	 { (char *)"OutSynapse_dstSegIdx", (PyCFunction)_wrap_OutSynapse_dstSegIdx, METH_O, (char *)"OutSynapse_dstSegIdx(self) -> nupic::UInt"},
	 { (char *)"OutSynapse_goesTo", (PyCFunction) _wrap_OutSynapse_goesTo, METH_VARARGS | METH_KEYWORDS, (char *)"OutSynapse_goesTo(self, dstCellIdx, dstSegIdx) -> bool"},
	 { (char *)"OutSynapse_equals", (PyCFunction) _wrap_OutSynapse_equals, METH_VARARGS | METH_KEYWORDS, (char *)"OutSynapse_equals(self, o) -> bool"},
	 { (char *)"OutSynapse_invariants", (PyCFunction) _wrap_OutSynapse_invariants, METH_VARARGS | METH_KEYWORDS, (char *)"OutSynapse_invariants(self, cells=None) -> bool"},
	 { (char *)"delete_OutSynapse", (PyCFunction)_wrap_delete_OutSynapse, METH_O, (char *)"delete_OutSynapse(self)"},
	 { (char *)"OutSynapse_swigregister", OutSynapse_swigregister, METH_VARARGS, NULL},
	 { (char *)"__eq__", (PyCFunction) _wrap___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"__eq__(a, b) -> bool"},
	 { (char *)"new_InSynapse", _wrap_new_InSynapse, METH_VARARGS, (char *)"\n"
		"InSynapse()\n"
		"InSynapse(srcCellIdx, permanence)\n"
		"new_InSynapse(o) -> InSynapse\n"
		""},
	 { (char *)"InSynapse_srcCellIdx", (PyCFunction)_wrap_InSynapse_srcCellIdx, METH_O, (char *)"InSynapse_srcCellIdx(self) -> nupic::UInt"},
	 { (char *)"InSynapse_permanence", _wrap_InSynapse_permanence, METH_VARARGS, (char *)"\n"
		"permanence() -> nupic::Real const\n"
		"InSynapse_permanence(self) -> nupic::Real &\n"
		""},
	 { (char *)"delete_InSynapse", (PyCFunction)_wrap_delete_InSynapse, METH_O, (char *)"delete_InSynapse(self)"},
	 { (char *)"InSynapse_swigregister", InSynapse_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_Cell", (PyCFunction)_wrap_new_Cell, METH_NOARGS, (char *)"new_Cell() -> Cell"},
	 { (char *)"Cell_empty", (PyCFunction)_wrap_Cell_empty, METH_O, (char *)"Cell_empty(self) -> bool"},
	 { (char *)"Cell_nSynapses", (PyCFunction)_wrap_Cell_nSynapses, METH_O, (char *)"Cell_nSynapses(self) -> nupic::UInt"},
	 { (char *)"Cell_size", (PyCFunction)_wrap_Cell_size, METH_O, (char *)"Cell_size(self) -> nupic::UInt"},
	 { (char *)"Cell_nSegments", (PyCFunction)_wrap_Cell_nSegments, METH_O, (char *)"Cell_nSegments(self) -> nupic::UInt"},
	 { (char *)"Cell_getNonEmptySegList", (PyCFunction)_wrap_Cell_getNonEmptySegList, METH_O, (char *)"Cell_getNonEmptySegList(self) -> VectorOfUInt32"},
	 { (char *)"Cell_getSegment", (PyCFunction) _wrap_Cell_getSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_getSegment(self, segIdx) -> Segment"},
	 { (char *)"Cell_getFreeSegment", (PyCFunction) _wrap_Cell_getFreeSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_getFreeSegment(self, synapses, initFrequency, sequenceSegmentFlag, permConnected, iteration) -> nupic::UInt"},
	 { (char *)"Cell_setSegmentOrder", (PyCFunction) _wrap_Cell_setSegmentOrder, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_setSegmentOrder(matchPythonOrder)"},
	 { (char *)"Cell_updateDutyCycle", (PyCFunction) _wrap_Cell_updateDutyCycle, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_updateDutyCycle(self, iterations)"},
	 { (char *)"Cell_rebalanceSegments", (PyCFunction)_wrap_Cell_rebalanceSegments, METH_O, (char *)"Cell_rebalanceSegments(self)"},
	 { (char *)"Cell_getMostActiveSegment", (PyCFunction)_wrap_Cell_getMostActiveSegment, METH_O, (char *)"Cell_getMostActiveSegment(self) -> nupic::UInt"},
	 { (char *)"Cell_releaseSegment", (PyCFunction) _wrap_Cell_releaseSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_releaseSegment(self, segIdx)"},
	 { (char *)"Cell_invariants", (PyCFunction) _wrap_Cell_invariants, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_invariants(self, arg2=None) -> bool"},
	 { (char *)"Cell_persistentSize", (PyCFunction)_wrap_Cell_persistentSize, METH_O, (char *)"Cell_persistentSize(self) -> nupic::UInt"},
	 { (char *)"Cell_save", (PyCFunction) _wrap_Cell_save, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_save(self, outStream)"},
	 { (char *)"Cell_load", (PyCFunction) _wrap_Cell_load, METH_VARARGS | METH_KEYWORDS, (char *)"Cell_load(self, inStream)"},
	 { (char *)"delete_Cell", (PyCFunction)_wrap_delete_Cell, METH_O, (char *)"delete_Cell(self)"},
	 { (char *)"Cell_swigregister", Cell_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_Cells4", (PyCFunction) _wrap_new_Cells4, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"new_Cells4(nColumns=0, nCellsPerCol=0, activationThreshold=1, minThreshold=1, newSynapseCount=1, \n"
		"    segUpdateValidDuration=1, permInitial=.5, permConnected=.8, permMax=1, \n"
		"    permDec=.1, permInc=.1, globalDecay=0, doPooling=False, seed=-1, initFromCpp=False, \n"
		"    checkSynapseConsistency=False) -> Cells4\n"
		""},
	 { (char *)"Cells4_initialize", (PyCFunction) _wrap_Cells4_initialize, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"Cells4_initialize(self, nColumns=0, nCellsPerCol=0, activationThreshold=1, minThreshold=1, newSynapseCount=1, \n"
		"    segUpdateValidDuration=1, permInitial=.5, permConnected=.8, permMax=1, \n"
		"    permDec=.1, permInc=.1, globalDecay=.1, doPooling=False, initFromCpp=False, \n"
		"    checkSynapseConsistency=False)\n"
		""},
	 { (char *)"delete_Cells4", (PyCFunction)_wrap_delete_Cells4, METH_O, (char *)"delete_Cells4(self)"},
	 { (char *)"Cells4_version", (PyCFunction)_wrap_Cells4_version, METH_O, (char *)"Cells4_version(self) -> nupic::UInt"},
	 { (char *)"Cells4_getStatePointers", (PyCFunction) _wrap_Cells4_getStatePointers, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"Cells4_getStatePointers(self, activeT, activeT1, predT, predT1, colConfidenceT, colConfidenceT1, confidenceT, \n"
		"    confidenceT1)\n"
		""},
	 { (char *)"Cells4_getLearnStatePointers", (PyCFunction) _wrap_Cells4_getLearnStatePointers, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getLearnStatePointers(self, activeT, activeT1, predT, predT1)"},
	 { (char *)"Cells4_nSegments", (PyCFunction)_wrap_Cells4_nSegments, METH_O, (char *)"Cells4_nSegments(self) -> nupic::UInt"},
	 { (char *)"Cells4_nCells", (PyCFunction)_wrap_Cells4_nCells, METH_O, (char *)"Cells4_nCells(self) -> nupic::UInt"},
	 { (char *)"Cells4_nColumns", (PyCFunction)_wrap_Cells4_nColumns, METH_O, (char *)"Cells4_nColumns(self) -> nupic::UInt"},
	 { (char *)"Cells4_nCellsPerCol", (PyCFunction)_wrap_Cells4_nCellsPerCol, METH_O, (char *)"Cells4_nCellsPerCol(self) -> nupic::UInt"},
	 { (char *)"Cells4_getMinThreshold", (PyCFunction)_wrap_Cells4_getMinThreshold, METH_O, (char *)"Cells4_getMinThreshold(self) -> nupic::UInt"},
	 { (char *)"Cells4_getPermConnected", (PyCFunction)_wrap_Cells4_getPermConnected, METH_O, (char *)"Cells4_getPermConnected(self) -> nupic::Real"},
	 { (char *)"Cells4_getVerbosity", (PyCFunction)_wrap_Cells4_getVerbosity, METH_O, (char *)"Cells4_getVerbosity(self) -> nupic::UInt"},
	 { (char *)"Cells4_getMaxAge", (PyCFunction)_wrap_Cells4_getMaxAge, METH_O, (char *)"Cells4_getMaxAge(self) -> nupic::UInt"},
	 { (char *)"Cells4_getPamLength", (PyCFunction)_wrap_Cells4_getPamLength, METH_O, (char *)"Cells4_getPamLength(self) -> nupic::UInt"},
	 { (char *)"Cells4_getMaxInfBacktrack", (PyCFunction)_wrap_Cells4_getMaxInfBacktrack, METH_O, (char *)"Cells4_getMaxInfBacktrack(self) -> nupic::UInt"},
	 { (char *)"Cells4_getMaxLrnBacktrack", (PyCFunction)_wrap_Cells4_getMaxLrnBacktrack, METH_O, (char *)"Cells4_getMaxLrnBacktrack(self) -> nupic::UInt"},
	 { (char *)"Cells4_getPamCounter", (PyCFunction)_wrap_Cells4_getPamCounter, METH_O, (char *)"Cells4_getPamCounter(self) -> nupic::UInt"},
	 { (char *)"Cells4_getMaxSeqLength", (PyCFunction)_wrap_Cells4_getMaxSeqLength, METH_O, (char *)"Cells4_getMaxSeqLength(self) -> nupic::UInt"},
	 { (char *)"Cells4_getAvgLearnedSeqLength", (PyCFunction)_wrap_Cells4_getAvgLearnedSeqLength, METH_O, (char *)"Cells4_getAvgLearnedSeqLength(self) -> nupic::Real"},
	 { (char *)"Cells4_getNLrnIterations", (PyCFunction)_wrap_Cells4_getNLrnIterations, METH_O, (char *)"Cells4_getNLrnIterations(self) -> nupic::UInt"},
	 { (char *)"Cells4_getmaxSegmentsPerCell", (PyCFunction)_wrap_Cells4_getmaxSegmentsPerCell, METH_O, (char *)"Cells4_getmaxSegmentsPerCell(self) -> nupic::Int"},
	 { (char *)"Cells4_getMaxSynapsesPerCell", (PyCFunction)_wrap_Cells4_getMaxSynapsesPerCell, METH_O, (char *)"Cells4_getMaxSynapsesPerCell(self) -> nupic::Int"},
	 { (char *)"Cells4_getCheckSynapseConsistency", (PyCFunction)_wrap_Cells4_getCheckSynapseConsistency, METH_O, (char *)"Cells4_getCheckSynapseConsistency(self) -> bool"},
	 { (char *)"Cells4_setMaxInfBacktrack", (PyCFunction) _wrap_Cells4_setMaxInfBacktrack, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxInfBacktrack(self, t)"},
	 { (char *)"Cells4_setMaxLrnBacktrack", (PyCFunction) _wrap_Cells4_setMaxLrnBacktrack, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxLrnBacktrack(self, t)"},
	 { (char *)"Cells4_setVerbosity", (PyCFunction) _wrap_Cells4_setVerbosity, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setVerbosity(self, v)"},
	 { (char *)"Cells4_setMaxAge", (PyCFunction) _wrap_Cells4_setMaxAge, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxAge(self, a)"},
	 { (char *)"Cells4_setMaxSeqLength", (PyCFunction) _wrap_Cells4_setMaxSeqLength, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxSeqLength(self, v)"},
	 { (char *)"Cells4_setCheckSynapseConsistency", (PyCFunction) _wrap_Cells4_setCheckSynapseConsistency, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setCheckSynapseConsistency(self, val)"},
	 { (char *)"Cells4_setMaxSegmentsPerCell", (PyCFunction) _wrap_Cells4_setMaxSegmentsPerCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxSegmentsPerCell(self, maxSegs)"},
	 { (char *)"Cells4_setMaxSynapsesPerCell", (PyCFunction) _wrap_Cells4_setMaxSynapsesPerCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setMaxSynapsesPerCell(self, maxSyns)"},
	 { (char *)"Cells4_setPamLength", (PyCFunction) _wrap_Cells4_setPamLength, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setPamLength(self, pl)"},
	 { (char *)"Cells4_nSegmentsOnCell", (PyCFunction) _wrap_Cells4_nSegmentsOnCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_nSegmentsOnCell(self, colIdx, cellIdxInCol) -> nupic::UInt"},
	 { (char *)"Cells4_nSynapses", (PyCFunction)_wrap_Cells4_nSynapses, METH_O, (char *)"Cells4_nSynapses(self) -> nupic::UInt"},
	 { (char *)"Cells4___nSegmentsOnCell", (PyCFunction) _wrap_Cells4___nSegmentsOnCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4___nSegmentsOnCell(self, cellIdx) -> nupic::UInt"},
	 { (char *)"Cells4_nSynapsesInCell", (PyCFunction) _wrap_Cells4_nSynapsesInCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_nSynapsesInCell(self, cellIdx) -> nupic::UInt"},
	 { (char *)"Cells4_getCell", (PyCFunction) _wrap_Cells4_getCell, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getCell(self, colIdx, cellIdxInCol) -> Cell"},
	 { (char *)"Cells4_getCellIdx", (PyCFunction) _wrap_Cells4_getCellIdx, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getCellIdx(self, colIdx, cellIdxInCol) -> nupic::UInt"},
	 { (char *)"Cells4_getSegment", (PyCFunction) _wrap_Cells4_getSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getSegment(self, colIdx, cellIdxInCol, segIdx) -> Segment"},
	 { (char *)"Cells4_segment", (PyCFunction) _wrap_Cells4_segment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_segment(self, cellIdx, segIdx) -> Segment"},
	 { (char *)"Cells4_reset", (PyCFunction)_wrap_Cells4_reset, METH_O, (char *)"Cells4_reset(self)"},
	 { (char *)"Cells4_isActive", (PyCFunction) _wrap_Cells4_isActive, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_isActive(self, cellIdx, segIdx, state) -> bool"},
	 { (char *)"Cells4_getBestMatchingCellT", (PyCFunction) _wrap_Cells4_getBestMatchingCellT, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getBestMatchingCellT(self, colIdx, state, minThreshold) -> PairOfUInt32"},
	 { (char *)"Cells4_getBestMatchingCellT1", (PyCFunction) _wrap_Cells4_getBestMatchingCellT1, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getBestMatchingCellT1(self, colIdx, state, minThreshold) -> PairOfUInt32"},
	 { (char *)"Cells4_computeForwardPropagation", _wrap_Cells4_computeForwardPropagation, METH_VARARGS, (char *)"\n"
		"computeForwardPropagation(state)\n"
		"Cells4_computeForwardPropagation(self, state)\n"
		""},
	 { (char *)"Cells4_updateInferenceState", (PyCFunction) _wrap_Cells4_updateInferenceState, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_updateInferenceState(self, activeColumns)"},
	 { (char *)"Cells4_inferPhase1", (PyCFunction) _wrap_Cells4_inferPhase1, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_inferPhase1(self, activeColumns, useStartCells) -> bool"},
	 { (char *)"Cells4_inferPhase2", (PyCFunction)_wrap_Cells4_inferPhase2, METH_O, (char *)"Cells4_inferPhase2(self) -> bool"},
	 { (char *)"Cells4_inferBacktrack", (PyCFunction) _wrap_Cells4_inferBacktrack, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_inferBacktrack(self, activeColumns)"},
	 { (char *)"Cells4_updateLearningState", (PyCFunction) _wrap_Cells4_updateLearningState, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_updateLearningState(self, activeColumns, input)"},
	 { (char *)"Cells4_learnPhase1", (PyCFunction) _wrap_Cells4_learnPhase1, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_learnPhase1(self, activeColumns, readOnly) -> bool"},
	 { (char *)"Cells4_learnPhase2", (PyCFunction) _wrap_Cells4_learnPhase2, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_learnPhase2(self, readOnly)"},
	 { (char *)"Cells4_learnBacktrack", (PyCFunction)_wrap_Cells4_learnBacktrack, METH_O, (char *)"Cells4_learnBacktrack(self) -> nupic::UInt"},
	 { (char *)"Cells4_learnBacktrackFrom", (PyCFunction) _wrap_Cells4_learnBacktrackFrom, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_learnBacktrackFrom(self, startOffset, readOnly) -> bool"},
	 { (char *)"Cells4__updateAvgLearnedSeqLength", (PyCFunction) _wrap_Cells4__updateAvgLearnedSeqLength, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4__updateAvgLearnedSeqLength(self, prevSeqLength)"},
	 { (char *)"Cells4_chooseCellsToLearnFrom", (PyCFunction) _wrap_Cells4_chooseCellsToLearnFrom, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_chooseCellsToLearnFrom(self, cellIdx, segIdx, nSynToAdd, state, srcCells)"},
	 { (char *)"Cells4_getCellForNewSegment", (PyCFunction) _wrap_Cells4_getCellForNewSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getCellForNewSegment(self, colIdx) -> nupic::UInt"},
	 { (char *)"Cells4_computeUpdate", (PyCFunction) _wrap_Cells4_computeUpdate, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_computeUpdate(self, cellIdx, segIdx, activeState, sequenceSegmentFlag, newSynapsesFlag) -> bool"},
	 { (char *)"Cells4_eraseOutSynapses", (PyCFunction) _wrap_Cells4_eraseOutSynapses, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_eraseOutSynapses(self, dstCellIdx, dstSegIdx, srcCells)"},
	 { (char *)"Cells4_processSegmentUpdates", (PyCFunction) _wrap_Cells4_processSegmentUpdates, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_processSegmentUpdates(self, input, predictedState)"},
	 { (char *)"Cells4_cleanUpdatesList", (PyCFunction) _wrap_Cells4_cleanUpdatesList, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_cleanUpdatesList(self, cellIdx, segIdx)"},
	 { (char *)"Cells4_applyGlobalDecay", (PyCFunction)_wrap_Cells4_applyGlobalDecay, METH_O, (char *)"Cells4_applyGlobalDecay(self)"},
	 { (char *)"Cells4_adaptSegment", (PyCFunction) _wrap_Cells4_adaptSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_adaptSegment(self, update)"},
	 { (char *)"Cells4_trimSegments", (PyCFunction) _wrap_Cells4_trimSegments, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_trimSegments(self, minPermanence, minNumSyns) -> PairOfUInt32"},
	 { (char *)"Cells4_persistentSize", (PyCFunction)_wrap_Cells4_persistentSize, METH_O, (char *)"Cells4_persistentSize(self) -> nupic::UInt"},
	 { (char *)"Cells4_saveToFile", (PyCFunction) _wrap_Cells4_saveToFile, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_saveToFile(self, filePath)"},
	 { (char *)"Cells4_loadFromFile", (PyCFunction) _wrap_Cells4_loadFromFile, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_loadFromFile(self, filePath)"},
	 { (char *)"Cells4_save", (PyCFunction) _wrap_Cells4_save, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_save(self, outStream)"},
	 { (char *)"Cells4_load", (PyCFunction) _wrap_Cells4_load, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_load(self, inStream)"},
	 { (char *)"Cells4_setCellSegmentOrder", (PyCFunction) _wrap_Cells4_setCellSegmentOrder, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_setCellSegmentOrder(self, matchPythonOrder)"},
	 { (char *)"Cells4_addNewSegment", (PyCFunction) _wrap_Cells4_addNewSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_addNewSegment(self, colIdx, cellIdxInCol, sequenceSegmentFlag, extSynapses)"},
	 { (char *)"Cells4_updateSegment", (PyCFunction) _wrap_Cells4_updateSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_updateSegment(self, colIdx, cellIdxInCol, segIdx, extSynapses)"},
	 { (char *)"Cells4__rebalance", (PyCFunction)_wrap_Cells4__rebalance, METH_O, (char *)"Cells4__rebalance(self)"},
	 { (char *)"Cells4_rebuildOutSynapses", (PyCFunction)_wrap_Cells4_rebuildOutSynapses, METH_O, (char *)"Cells4_rebuildOutSynapses(self)"},
	 { (char *)"Cells4_trimOldSegments", (PyCFunction) _wrap_Cells4_trimOldSegments, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_trimOldSegments(self, age)"},
	 { (char *)"Cells4_printStates", (PyCFunction)_wrap_Cells4_printStates, METH_O, (char *)"Cells4_printStates(self)"},
	 { (char *)"Cells4_printState", (PyCFunction) _wrap_Cells4_printState, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_printState(self, state)"},
	 { (char *)"Cells4_dumpPrevPatterns", (PyCFunction) _wrap_Cells4_dumpPrevPatterns, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_dumpPrevPatterns(self, patterns)"},
	 { (char *)"Cells4_dumpSegmentUpdates", (PyCFunction)_wrap_Cells4_dumpSegmentUpdates, METH_O, (char *)"Cells4_dumpSegmentUpdates(self)"},
	 { (char *)"Cells4_getNonEmptySegList", (PyCFunction) _wrap_Cells4_getNonEmptySegList, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_getNonEmptySegList(self, colIdx, cellIdxInCol) -> VectorOfUInt32"},
	 { (char *)"Cells4_dumpTiming", (PyCFunction)_wrap_Cells4_dumpTiming, METH_O, (char *)"Cells4_dumpTiming(self)"},
	 { (char *)"Cells4_resetTimers", (PyCFunction)_wrap_Cells4_resetTimers, METH_O, (char *)"Cells4_resetTimers(self)"},
	 { (char *)"Cells4_invariants", (PyCFunction) _wrap_Cells4_invariants, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_invariants(self, verbose=False) -> bool"},
	 { (char *)"Cells4_stats", (PyCFunction)_wrap_Cells4_stats, METH_O, (char *)"Cells4_stats(self)"},
	 { (char *)"Cells4_loadFromString", (PyCFunction) _wrap_Cells4_loadFromString, METH_VARARGS | METH_KEYWORDS, (char *)"Cells4_loadFromString(self, inString)"},
	 { (char *)"Cells4___getstate__", (PyCFunction)_wrap_Cells4___getstate__, METH_O, (char *)"Cells4___getstate__(self) -> PyObject *"},
	 { (char *)"Cells4_setStatePointers", _wrap_Cells4_setStatePointers, METH_VARARGS, (char *)"\n"
		"setStatePointers(infActiveT, infActiveT1, infPredT, infPredT1, colConfidenceT, colConfidenceT1, cellConfidenceT, \n"
		"    cellConfidenceT1)\n"
		"Cells4_setStatePointers(self, py_infActiveStateT, py_infActiveStateT1, py_infPredictedStateT, py_infPredictedStateT1, \n"
		"    py_colConfidenceT, py_colConfidenceT1, py_cellConfidenceT, py_cellConfidenceT1)\n"
		""},
	 { (char *)"Cells4_getStates", (PyCFunction)_wrap_Cells4_getStates, METH_O, (char *)"Cells4_getStates(self) -> PyObject *"},
	 { (char *)"Cells4_getLearnStates", (PyCFunction)_wrap_Cells4_getLearnStates, METH_O, (char *)"Cells4_getLearnStates(self) -> PyObject *"},
	 { (char *)"Cells4_compute", _wrap_Cells4_compute, METH_VARARGS, (char *)"\n"
		"compute(input, output, doInference, doLearning)\n"
		"Cells4_compute(self, py_x, doInference, doLearning) -> PyObject *\n"
		""},
	 { (char *)"Cells4_swigregister", Cells4_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_SpatialPooler", _wrap_new_SpatialPooler, METH_VARARGS, (char *)"\n"
		"SpatialPooler()\n"
		"new_SpatialPooler(inputDimensions, columnDimensions, potentialRadius=16, potentialPct=0.5, globalInhibition=True, \n"
		"    localAreaDensity=-1.0, numActiveColumnsPerInhArea=10, stimulusThreshold=0, \n"
		"    synPermInactiveDec=0.01, synPermActiveInc=0.1, synPermConnected=0.1, \n"
		"    minPctOverlapDutyCycles=0.001, minPctActiveDutyCycles=0.001, dutyCyclePeriod=1000, \n"
		"    maxBoost=10.0, seed=1, spVerbosity=0, wrapAround=True) -> SpatialPooler\n"
		""},
	 { (char *)"delete_SpatialPooler", (PyCFunction)_wrap_delete_SpatialPooler, METH_O, (char *)"delete_SpatialPooler(self)"},
	 { (char *)"SpatialPooler_initialize", (PyCFunction) _wrap_SpatialPooler_initialize, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
		"SpatialPooler_initialize(self, inputDimensions, columnDimensions, potentialRadius=16, potentialPct=0.5, globalInhibition=True, \n"
		"    localAreaDensity=-1.0, numActiveColumnsPerInhArea=10, \n"
		"    stimulusThreshold=0, synPermInactiveDec=0.01, synPermActiveInc=0.1, synPermConnected=0.1, \n"
		"    minPctOverlapDutyCycles=0.001, minPctActiveDutyCycles=0.001, \n"
		"    dutyCyclePeriod=1000, maxBoost=10.0, seed=1, spVerbosity=0, wrapAround=True)\n"
		""},
	 { (char *)"SpatialPooler_version", (PyCFunction)_wrap_SpatialPooler_version, METH_O, (char *)"SpatialPooler_version(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_save", (PyCFunction) _wrap_SpatialPooler_save, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_save(self, outStream)"},
	 { (char *)"SpatialPooler_load", (PyCFunction) _wrap_SpatialPooler_load, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_load(self, inStream)"},
	 { (char *)"SpatialPooler_persistentSize", (PyCFunction)_wrap_SpatialPooler_persistentSize, METH_O, (char *)"SpatialPooler_persistentSize(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_getColumnDimensions", (PyCFunction)_wrap_SpatialPooler_getColumnDimensions, METH_O, (char *)"SpatialPooler_getColumnDimensions(self) -> VectorOfUInt32"},
	 { (char *)"SpatialPooler_getInputDimensions", (PyCFunction)_wrap_SpatialPooler_getInputDimensions, METH_O, (char *)"SpatialPooler_getInputDimensions(self) -> VectorOfUInt32"},
	 { (char *)"SpatialPooler_getNumColumns", (PyCFunction)_wrap_SpatialPooler_getNumColumns, METH_O, (char *)"SpatialPooler_getNumColumns(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_getNumInputs", (PyCFunction)_wrap_SpatialPooler_getNumInputs, METH_O, (char *)"SpatialPooler_getNumInputs(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_getPotentialRadius", (PyCFunction)_wrap_SpatialPooler_getPotentialRadius, METH_O, (char *)"SpatialPooler_getPotentialRadius(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setPotentialRadius", (PyCFunction) _wrap_SpatialPooler_setPotentialRadius, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setPotentialRadius(self, potentialRadius)"},
	 { (char *)"SpatialPooler_getPotentialPct", (PyCFunction)_wrap_SpatialPooler_getPotentialPct, METH_O, (char *)"SpatialPooler_getPotentialPct(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setPotentialPct", (PyCFunction) _wrap_SpatialPooler_setPotentialPct, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setPotentialPct(self, potentialPct)"},
	 { (char *)"SpatialPooler_getGlobalInhibition", (PyCFunction)_wrap_SpatialPooler_getGlobalInhibition, METH_O, (char *)"SpatialPooler_getGlobalInhibition(self) -> bool"},
	 { (char *)"SpatialPooler_setGlobalInhibition", (PyCFunction) _wrap_SpatialPooler_setGlobalInhibition, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setGlobalInhibition(self, globalInhibition)"},
	 { (char *)"SpatialPooler_getNumActiveColumnsPerInhArea", (PyCFunction)_wrap_SpatialPooler_getNumActiveColumnsPerInhArea, METH_O, (char *)"SpatialPooler_getNumActiveColumnsPerInhArea(self) -> nupic::Int"},
	 { (char *)"SpatialPooler_setNumActiveColumnsPerInhArea", (PyCFunction) _wrap_SpatialPooler_setNumActiveColumnsPerInhArea, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setNumActiveColumnsPerInhArea(self, numActiveColumnsPerInhArea)"},
	 { (char *)"SpatialPooler_getLocalAreaDensity", (PyCFunction)_wrap_SpatialPooler_getLocalAreaDensity, METH_O, (char *)"SpatialPooler_getLocalAreaDensity(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setLocalAreaDensity", (PyCFunction) _wrap_SpatialPooler_setLocalAreaDensity, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setLocalAreaDensity(self, localAreaDensity)"},
	 { (char *)"SpatialPooler_getStimulusThreshold", (PyCFunction)_wrap_SpatialPooler_getStimulusThreshold, METH_O, (char *)"SpatialPooler_getStimulusThreshold(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setStimulusThreshold", (PyCFunction) _wrap_SpatialPooler_setStimulusThreshold, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setStimulusThreshold(self, stimulusThreshold)"},
	 { (char *)"SpatialPooler_getInhibitionRadius", (PyCFunction)_wrap_SpatialPooler_getInhibitionRadius, METH_O, (char *)"SpatialPooler_getInhibitionRadius(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setInhibitionRadius", (PyCFunction) _wrap_SpatialPooler_setInhibitionRadius, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setInhibitionRadius(self, inhibitionRadius)"},
	 { (char *)"SpatialPooler_getDutyCyclePeriod", (PyCFunction)_wrap_SpatialPooler_getDutyCyclePeriod, METH_O, (char *)"SpatialPooler_getDutyCyclePeriod(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setDutyCyclePeriod", (PyCFunction) _wrap_SpatialPooler_setDutyCyclePeriod, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setDutyCyclePeriod(self, dutyCyclePeriod)"},
	 { (char *)"SpatialPooler_getMaxBoost", (PyCFunction)_wrap_SpatialPooler_getMaxBoost, METH_O, (char *)"SpatialPooler_getMaxBoost(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setMaxBoost", (PyCFunction) _wrap_SpatialPooler_setMaxBoost, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setMaxBoost(self, maxBoost)"},
	 { (char *)"SpatialPooler_getIterationNum", (PyCFunction)_wrap_SpatialPooler_getIterationNum, METH_O, (char *)"SpatialPooler_getIterationNum(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setIterationNum", (PyCFunction) _wrap_SpatialPooler_setIterationNum, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setIterationNum(self, iterationNum)"},
	 { (char *)"SpatialPooler_getIterationLearnNum", (PyCFunction)_wrap_SpatialPooler_getIterationLearnNum, METH_O, (char *)"SpatialPooler_getIterationLearnNum(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setIterationLearnNum", (PyCFunction) _wrap_SpatialPooler_setIterationLearnNum, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setIterationLearnNum(self, iterationLearnNum)"},
	 { (char *)"SpatialPooler_getSpVerbosity", (PyCFunction)_wrap_SpatialPooler_getSpVerbosity, METH_O, (char *)"SpatialPooler_getSpVerbosity(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setSpVerbosity", (PyCFunction) _wrap_SpatialPooler_setSpVerbosity, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSpVerbosity(self, spVerbosity)"},
	 { (char *)"SpatialPooler_getWrapAround", (PyCFunction)_wrap_SpatialPooler_getWrapAround, METH_O, (char *)"SpatialPooler_getWrapAround(self) -> bool"},
	 { (char *)"SpatialPooler_setWrapAround", (PyCFunction) _wrap_SpatialPooler_setWrapAround, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setWrapAround(self, wrapAround)"},
	 { (char *)"SpatialPooler_getUpdatePeriod", (PyCFunction)_wrap_SpatialPooler_getUpdatePeriod, METH_O, (char *)"SpatialPooler_getUpdatePeriod(self) -> nupic::UInt"},
	 { (char *)"SpatialPooler_setUpdatePeriod", (PyCFunction) _wrap_SpatialPooler_setUpdatePeriod, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setUpdatePeriod(self, updatePeriod)"},
	 { (char *)"SpatialPooler_getSynPermTrimThreshold", (PyCFunction)_wrap_SpatialPooler_getSynPermTrimThreshold, METH_O, (char *)"SpatialPooler_getSynPermTrimThreshold(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setSynPermTrimThreshold", (PyCFunction) _wrap_SpatialPooler_setSynPermTrimThreshold, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSynPermTrimThreshold(self, synPermTrimThreshold)"},
	 { (char *)"SpatialPooler_getSynPermActiveInc", (PyCFunction)_wrap_SpatialPooler_getSynPermActiveInc, METH_O, (char *)"SpatialPooler_getSynPermActiveInc(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setSynPermActiveInc", (PyCFunction) _wrap_SpatialPooler_setSynPermActiveInc, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSynPermActiveInc(self, synPermActiveInc)"},
	 { (char *)"SpatialPooler_getSynPermInactiveDec", (PyCFunction)_wrap_SpatialPooler_getSynPermInactiveDec, METH_O, (char *)"SpatialPooler_getSynPermInactiveDec(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setSynPermInactiveDec", (PyCFunction) _wrap_SpatialPooler_setSynPermInactiveDec, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSynPermInactiveDec(self, synPermInactiveDec)"},
	 { (char *)"SpatialPooler_getSynPermBelowStimulusInc", (PyCFunction)_wrap_SpatialPooler_getSynPermBelowStimulusInc, METH_O, (char *)"SpatialPooler_getSynPermBelowStimulusInc(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setSynPermBelowStimulusInc", (PyCFunction) _wrap_SpatialPooler_setSynPermBelowStimulusInc, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSynPermBelowStimulusInc(self, synPermBelowStimulusInc)"},
	 { (char *)"SpatialPooler_getSynPermConnected", (PyCFunction)_wrap_SpatialPooler_getSynPermConnected, METH_O, (char *)"SpatialPooler_getSynPermConnected(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setSynPermConnected", (PyCFunction) _wrap_SpatialPooler_setSynPermConnected, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setSynPermConnected(self, setSynPermConnected)"},
	 { (char *)"SpatialPooler_getMinPctOverlapDutyCycles", (PyCFunction)_wrap_SpatialPooler_getMinPctOverlapDutyCycles, METH_O, (char *)"SpatialPooler_getMinPctOverlapDutyCycles(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setMinPctOverlapDutyCycles", (PyCFunction) _wrap_SpatialPooler_setMinPctOverlapDutyCycles, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setMinPctOverlapDutyCycles(self, minPctOverlapDutyCycles)"},
	 { (char *)"SpatialPooler_getMinPctActiveDutyCycles", (PyCFunction)_wrap_SpatialPooler_getMinPctActiveDutyCycles, METH_O, (char *)"SpatialPooler_getMinPctActiveDutyCycles(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_setMinPctActiveDutyCycles", (PyCFunction) _wrap_SpatialPooler_setMinPctActiveDutyCycles, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_setMinPctActiveDutyCycles(self, minPctActiveDutyCycles)"},
	 { (char *)"SpatialPooler_printParameters", (PyCFunction)_wrap_SpatialPooler_printParameters, METH_O, (char *)"SpatialPooler_printParameters(self)"},
	 { (char *)"SpatialPooler_toDense_", (PyCFunction) _wrap_SpatialPooler_toDense_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_toDense_(self, sparse, dense, n)"},
	 { (char *)"SpatialPooler_boostOverlaps_", (PyCFunction) _wrap_SpatialPooler_boostOverlaps_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_boostOverlaps_(self, overlaps, boostedOverlaps)"},
	 { (char *)"SpatialPooler_range_", (PyCFunction) _wrap_SpatialPooler_range_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_range_(self, start, end, ubound, wrapAround, rangeVector)"},
	 { (char *)"SpatialPooler_mapColumn_", (PyCFunction) _wrap_SpatialPooler_mapColumn_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_mapColumn_(self, column) -> nupic::UInt"},
	 { (char *)"SpatialPooler_mapPotential_", (PyCFunction) _wrap_SpatialPooler_mapPotential_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_mapPotential_(self, column, wrapAround) -> VectorOfUInt32"},
	 { (char *)"SpatialPooler_initPermConnected_", (PyCFunction)_wrap_SpatialPooler_initPermConnected_, METH_O, (char *)"SpatialPooler_initPermConnected_(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_initPermNonConnected_", (PyCFunction)_wrap_SpatialPooler_initPermNonConnected_, METH_O, (char *)"SpatialPooler_initPermNonConnected_(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_initPermanence_", (PyCFunction) _wrap_SpatialPooler_initPermanence_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_initPermanence_(self, potential, connectedPct) -> FloatVector"},
	 { (char *)"SpatialPooler_clip_", (PyCFunction) _wrap_SpatialPooler_clip_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_clip_(self, perm, trim)"},
	 { (char *)"SpatialPooler_updatePermanencesForColumn_", (PyCFunction) _wrap_SpatialPooler_updatePermanencesForColumn_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_updatePermanencesForColumn_(self, perm, column, raisePerm=True)"},
	 { (char *)"SpatialPooler_countConnected_", (PyCFunction) _wrap_SpatialPooler_countConnected_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_countConnected_(self, perm) -> nupic::UInt"},
	 { (char *)"SpatialPooler_raisePermanencesToThreshold_", (PyCFunction) _wrap_SpatialPooler_raisePermanencesToThreshold_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_raisePermanencesToThreshold_(self, perm, potential) -> nupic::UInt"},
	 { (char *)"SpatialPooler_calculateOverlap_", (PyCFunction) _wrap_SpatialPooler_calculateOverlap_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_calculateOverlap_(self, inputVector, overlap)"},
	 { (char *)"SpatialPooler_calculateOverlapPct_", (PyCFunction) _wrap_SpatialPooler_calculateOverlapPct_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_calculateOverlapPct_(self, overlaps, overlapPct)"},
	 { (char *)"SpatialPooler_isWinner_", (PyCFunction) _wrap_SpatialPooler_isWinner_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_isWinner_(self, score, winners, numWinners) -> bool"},
	 { (char *)"SpatialPooler_addToWinners_", (PyCFunction) _wrap_SpatialPooler_addToWinners_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_addToWinners_(self, index, score, winners)"},
	 { (char *)"SpatialPooler_inhibitColumns_", (PyCFunction) _wrap_SpatialPooler_inhibitColumns_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_inhibitColumns_(self, overlaps, activeColumns)"},
	 { (char *)"SpatialPooler_inhibitColumnsGlobal_", (PyCFunction) _wrap_SpatialPooler_inhibitColumnsGlobal_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_inhibitColumnsGlobal_(self, overlaps, density, activeColumns)"},
	 { (char *)"SpatialPooler_inhibitColumnsLocal_", (PyCFunction) _wrap_SpatialPooler_inhibitColumnsLocal_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_inhibitColumnsLocal_(self, overlaps, density, activeColumns)"},
	 { (char *)"SpatialPooler_getNeighbors1D_", (PyCFunction) _wrap_SpatialPooler_getNeighbors1D_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_getNeighbors1D_(self, column, dimensions, radius, wrapAround, neighbors)"},
	 { (char *)"SpatialPooler_getNeighbors2D_", (PyCFunction) _wrap_SpatialPooler_getNeighbors2D_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_getNeighbors2D_(self, column, dimensions, radius, wrapAround, neighbors)"},
	 { (char *)"SpatialPooler_cartesianProduct_", (PyCFunction) _wrap_SpatialPooler_cartesianProduct_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_cartesianProduct_(self, vecs, product)"},
	 { (char *)"SpatialPooler_getNeighborsND_", (PyCFunction) _wrap_SpatialPooler_getNeighborsND_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_getNeighborsND_(self, column, dimensions, radius, wrapAround, neighbors)"},
	 { (char *)"SpatialPooler_adaptSynapses_", (PyCFunction) _wrap_SpatialPooler_adaptSynapses_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_adaptSynapses_(self, inputVector, activeColumns)"},
	 { (char *)"SpatialPooler_bumpUpWeakColumns_", (PyCFunction)_wrap_SpatialPooler_bumpUpWeakColumns_, METH_O, (char *)"SpatialPooler_bumpUpWeakColumns_(self)"},
	 { (char *)"SpatialPooler_updateInhibitionRadius_", (PyCFunction)_wrap_SpatialPooler_updateInhibitionRadius_, METH_O, (char *)"SpatialPooler_updateInhibitionRadius_(self)"},
	 { (char *)"SpatialPooler_avgColumnsPerInput_", (PyCFunction)_wrap_SpatialPooler_avgColumnsPerInput_, METH_O, (char *)"SpatialPooler_avgColumnsPerInput_(self) -> nupic::Real"},
	 { (char *)"SpatialPooler_avgConnectedSpanForColumn1D_", (PyCFunction) _wrap_SpatialPooler_avgConnectedSpanForColumn1D_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_avgConnectedSpanForColumn1D_(self, column) -> nupic::Real"},
	 { (char *)"SpatialPooler_avgConnectedSpanForColumn2D_", (PyCFunction) _wrap_SpatialPooler_avgConnectedSpanForColumn2D_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_avgConnectedSpanForColumn2D_(self, column) -> nupic::Real"},
	 { (char *)"SpatialPooler_avgConnectedSpanForColumnND_", (PyCFunction) _wrap_SpatialPooler_avgConnectedSpanForColumnND_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_avgConnectedSpanForColumnND_(self, column) -> nupic::Real"},
	 { (char *)"SpatialPooler_updateMinDutyCycles_", (PyCFunction)_wrap_SpatialPooler_updateMinDutyCycles_, METH_O, (char *)"SpatialPooler_updateMinDutyCycles_(self)"},
	 { (char *)"SpatialPooler_updateMinDutyCyclesGlobal_", (PyCFunction)_wrap_SpatialPooler_updateMinDutyCyclesGlobal_, METH_O, (char *)"SpatialPooler_updateMinDutyCyclesGlobal_(self)"},
	 { (char *)"SpatialPooler_updateMinDutyCyclesLocal_", (PyCFunction)_wrap_SpatialPooler_updateMinDutyCyclesLocal_, METH_O, (char *)"SpatialPooler_updateMinDutyCyclesLocal_(self)"},
	 { (char *)"SpatialPooler_updateDutyCyclesHelper_", (PyCFunction) _wrap_SpatialPooler_updateDutyCyclesHelper_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_updateDutyCyclesHelper_(dutyCycles, newValues, period)"},
	 { (char *)"SpatialPooler_updateDutyCycles_", (PyCFunction) _wrap_SpatialPooler_updateDutyCycles_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_updateDutyCycles_(self, overlaps, activeArray)"},
	 { (char *)"SpatialPooler_updateBoostFactors_", (PyCFunction)_wrap_SpatialPooler_updateBoostFactors_, METH_O, (char *)"SpatialPooler_updateBoostFactors_(self)"},
	 { (char *)"SpatialPooler_updateBookeepingVars_", (PyCFunction) _wrap_SpatialPooler_updateBookeepingVars_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_updateBookeepingVars_(self, learn)"},
	 { (char *)"SpatialPooler_isUpdateRound_", (PyCFunction)_wrap_SpatialPooler_isUpdateRound_, METH_O, (char *)"SpatialPooler_isUpdateRound_(self) -> bool"},
	 { (char *)"SpatialPooler_seed_", (PyCFunction) _wrap_SpatialPooler_seed_, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_seed_(self, seed)"},
	 { (char *)"SpatialPooler_printState", _wrap_SpatialPooler_printState, METH_VARARGS, (char *)"\n"
		"printState(state)\n"
		"SpatialPooler_printState(self, state)\n"
		""},
	 { (char *)"SpatialPooler_compute", _wrap_SpatialPooler_compute, METH_VARARGS, (char *)"\n"
		"compute(inputVector, learn, activeVector, stripNeverLearned)\n"
		"compute(inputVector, learn, activeVector)\n"
		"SpatialPooler_compute(self, py_x, learn, py_y)\n"
		""},
	 { (char *)"SpatialPooler_stripUnlearnedColumns", _wrap_SpatialPooler_stripUnlearnedColumns, METH_VARARGS, (char *)"\n"
		"stripUnlearnedColumns(activeArray)\n"
		"SpatialPooler_stripUnlearnedColumns(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_write", _wrap_SpatialPooler_write, METH_VARARGS, (char *)"\n"
		"write(stream)\n"
		"write(proto)\n"
		"SpatialPooler_write(self, pyBuilder)\n"
		""},
	 { (char *)"SpatialPooler_read", _wrap_SpatialPooler_read, METH_VARARGS, (char *)"\n"
		"read(stream)\n"
		"read(proto)\n"
		"SpatialPooler_read(self, pyReader)\n"
		""},
	 { (char *)"SpatialPooler_loadFromString", (PyCFunction) _wrap_SpatialPooler_loadFromString, METH_VARARGS | METH_KEYWORDS, (char *)"SpatialPooler_loadFromString(self, inString)"},
	 { (char *)"SpatialPooler_getCState", (PyCFunction)_wrap_SpatialPooler_getCState, METH_O, (char *)"SpatialPooler_getCState(self) -> PyObject *"},
	 { (char *)"SpatialPooler_setBoostFactors", _wrap_SpatialPooler_setBoostFactors, METH_VARARGS, (char *)"\n"
		"setBoostFactors(boostFactors)\n"
		"SpatialPooler_setBoostFactors(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getBoostFactors", _wrap_SpatialPooler_getBoostFactors, METH_VARARGS, (char *)"\n"
		"getBoostFactors(boostFactors)\n"
		"SpatialPooler_getBoostFactors(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setOverlapDutyCycles", _wrap_SpatialPooler_setOverlapDutyCycles, METH_VARARGS, (char *)"\n"
		"setOverlapDutyCycles(overlapDutyCycles)\n"
		"SpatialPooler_setOverlapDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getOverlapDutyCycles", _wrap_SpatialPooler_getOverlapDutyCycles, METH_VARARGS, (char *)"\n"
		"getOverlapDutyCycles(overlapDutyCycles)\n"
		"SpatialPooler_getOverlapDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setActiveDutyCycles", _wrap_SpatialPooler_setActiveDutyCycles, METH_VARARGS, (char *)"\n"
		"setActiveDutyCycles(activeDutyCycles)\n"
		"SpatialPooler_setActiveDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getActiveDutyCycles", _wrap_SpatialPooler_getActiveDutyCycles, METH_VARARGS, (char *)"\n"
		"getActiveDutyCycles(activeDutyCycles)\n"
		"SpatialPooler_getActiveDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setMinOverlapDutyCycles", _wrap_SpatialPooler_setMinOverlapDutyCycles, METH_VARARGS, (char *)"\n"
		"setMinOverlapDutyCycles(minOverlapDutyCycles)\n"
		"SpatialPooler_setMinOverlapDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getMinOverlapDutyCycles", _wrap_SpatialPooler_getMinOverlapDutyCycles, METH_VARARGS, (char *)"\n"
		"getMinOverlapDutyCycles(minOverlapDutyCycles)\n"
		"SpatialPooler_getMinOverlapDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setMinActiveDutyCycles", _wrap_SpatialPooler_setMinActiveDutyCycles, METH_VARARGS, (char *)"\n"
		"setMinActiveDutyCycles(minActiveDutyCycles)\n"
		"SpatialPooler_setMinActiveDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getMinActiveDutyCycles", _wrap_SpatialPooler_getMinActiveDutyCycles, METH_VARARGS, (char *)"\n"
		"getMinActiveDutyCycles(minActiveDutyCycles)\n"
		"SpatialPooler_getMinActiveDutyCycles(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setPotential", _wrap_SpatialPooler_setPotential, METH_VARARGS, (char *)"\n"
		"setPotential(column, potential)\n"
		"SpatialPooler_setPotential(self, column, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getPotential", _wrap_SpatialPooler_getPotential, METH_VARARGS, (char *)"\n"
		"getPotential(column, potential)\n"
		"SpatialPooler_getPotential(self, column, py_x)\n"
		""},
	 { (char *)"SpatialPooler_setPermanence", _wrap_SpatialPooler_setPermanence, METH_VARARGS, (char *)"\n"
		"setPermanence(column, permanence)\n"
		"SpatialPooler_setPermanence(self, column, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getPermanence", _wrap_SpatialPooler_getPermanence, METH_VARARGS, (char *)"\n"
		"getPermanence(column, permanence)\n"
		"SpatialPooler_getPermanence(self, column, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getConnectedSynapses", _wrap_SpatialPooler_getConnectedSynapses, METH_VARARGS, (char *)"\n"
		"getConnectedSynapses(column, connectedSynapses)\n"
		"SpatialPooler_getConnectedSynapses(self, column, py_x)\n"
		""},
	 { (char *)"SpatialPooler_getConnectedCounts", _wrap_SpatialPooler_getConnectedCounts, METH_VARARGS, (char *)"\n"
		"getConnectedCounts(connectedCounts)\n"
		"SpatialPooler_getConnectedCounts(self, py_x)\n"
		""},
	 { (char *)"SpatialPooler_swigregister", SpatialPooler_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_FastCLAClassifier", _wrap_new_FastCLAClassifier, METH_VARARGS, (char *)"\n"
		"FastCLAClassifier()\n"
		"new_FastCLAClassifier(steps, alpha, actValueAlpha, verbosity) -> FastCLAClassifier\n"
		""},
	 { (char *)"delete_FastCLAClassifier", (PyCFunction)_wrap_delete_FastCLAClassifier, METH_O, (char *)"delete_FastCLAClassifier(self)"},
	 { (char *)"FastCLAClassifier_fastCompute", (PyCFunction) _wrap_FastCLAClassifier_fastCompute, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier_fastCompute(self, recordNum, patternNZ, bucketIdx, actValue, category, learn, infer, result)"},
	 { (char *)"FastCLAClassifier_version", (PyCFunction)_wrap_FastCLAClassifier_version, METH_O, (char *)"FastCLAClassifier_version(self) -> nupic::UInt"},
	 { (char *)"FastCLAClassifier_persistentSize", (PyCFunction)_wrap_FastCLAClassifier_persistentSize, METH_O, (char *)"FastCLAClassifier_persistentSize(self) -> nupic::UInt"},
	 { (char *)"FastCLAClassifier_save", (PyCFunction) _wrap_FastCLAClassifier_save, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier_save(self, outStream)"},
	 { (char *)"FastCLAClassifier_load", (PyCFunction) _wrap_FastCLAClassifier_load, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier_load(self, inStream)"},
	 { (char *)"FastCLAClassifier_write", _wrap_FastCLAClassifier_write, METH_VARARGS, (char *)"\n"
		"write(proto)\n"
		"FastCLAClassifier_write(self, proto)\n"
		""},
	 { (char *)"FastCLAClassifier_read", _wrap_FastCLAClassifier_read, METH_VARARGS, (char *)"\n"
		"read(proto)\n"
		"FastCLAClassifier_read(self, stream)\n"
		""},
	 { (char *)"FastCLAClassifier___eq__", (PyCFunction) _wrap_FastCLAClassifier___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier___eq__(self, other) -> bool"},
	 { (char *)"FastCLAClassifier_loadFromString", (PyCFunction) _wrap_FastCLAClassifier_loadFromString, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier_loadFromString(self, inString)"},
	 { (char *)"FastCLAClassifier_getCState", (PyCFunction)_wrap_FastCLAClassifier_getCState, METH_O, (char *)"FastCLAClassifier_getCState(self) -> PyObject *"},
	 { (char *)"FastCLAClassifier_convertedCompute", (PyCFunction) _wrap_FastCLAClassifier_convertedCompute, METH_VARARGS | METH_KEYWORDS, (char *)"FastCLAClassifier_convertedCompute(self, recordNum, patternNZ, bucketIdx, actValue, category, learn, infer) -> PyObject *"},
	 { (char *)"FastCLAClassifier_swigregister", FastCLAClassifier_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsSynapseVector_iterator", (PyCFunction)_wrap_ConnectionsSynapseVector_iterator, METH_O, (char *)"ConnectionsSynapseVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"ConnectionsSynapseVector___nonzero__", (PyCFunction)_wrap_ConnectionsSynapseVector___nonzero__, METH_O, (char *)"ConnectionsSynapseVector___nonzero__(self) -> bool"},
	 { (char *)"ConnectionsSynapseVector___bool__", (PyCFunction)_wrap_ConnectionsSynapseVector___bool__, METH_O, (char *)"ConnectionsSynapseVector___bool__(self) -> bool"},
	 { (char *)"ConnectionsSynapseVector___len__", (PyCFunction)_wrap_ConnectionsSynapseVector___len__, METH_O, (char *)"ConnectionsSynapseVector___len__(self) -> vector< nupic::algorithms::connections::Synapse >::size_type"},
	 { (char *)"ConnectionsSynapseVector_pop", (PyCFunction)_wrap_ConnectionsSynapseVector_pop, METH_O, (char *)"ConnectionsSynapseVector_pop(self) -> ConnectionsSynapse"},
	 { (char *)"ConnectionsSynapseVector___getslice__", (PyCFunction) _wrap_ConnectionsSynapseVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector___getslice__(self, i, j) -> std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *"},
	 { (char *)"ConnectionsSynapseVector___setslice__", (PyCFunction) _wrap_ConnectionsSynapseVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector___setslice__(self, i, j, v=std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >())"},
	 { (char *)"ConnectionsSynapseVector___delslice__", (PyCFunction) _wrap_ConnectionsSynapseVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector___delslice__(self, i, j)"},
	 { (char *)"ConnectionsSynapseVector___delitem__", _wrap_ConnectionsSynapseVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"ConnectionsSynapseVector___delitem__(self, slice)\n"
		""},
	 { (char *)"ConnectionsSynapseVector___getitem__", _wrap_ConnectionsSynapseVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >\n"
		"ConnectionsSynapseVector___getitem__(self, i) -> ConnectionsSynapse\n"
		""},
	 { (char *)"ConnectionsSynapseVector___setitem__", _wrap_ConnectionsSynapseVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"ConnectionsSynapseVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"ConnectionsSynapseVector_append", (PyCFunction) _wrap_ConnectionsSynapseVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector_append(self, x)"},
	 { (char *)"ConnectionsSynapseVector_empty", (PyCFunction)_wrap_ConnectionsSynapseVector_empty, METH_O, (char *)"ConnectionsSynapseVector_empty(self) -> bool"},
	 { (char *)"ConnectionsSynapseVector_size", (PyCFunction)_wrap_ConnectionsSynapseVector_size, METH_O, (char *)"ConnectionsSynapseVector_size(self) -> vector< nupic::algorithms::connections::Synapse >::size_type"},
	 { (char *)"ConnectionsSynapseVector_clear", (PyCFunction)_wrap_ConnectionsSynapseVector_clear, METH_O, (char *)"ConnectionsSynapseVector_clear(self)"},
	 { (char *)"ConnectionsSynapseVector_swap", (PyCFunction) _wrap_ConnectionsSynapseVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector_swap(self, v)"},
	 { (char *)"ConnectionsSynapseVector_get_allocator", (PyCFunction)_wrap_ConnectionsSynapseVector_get_allocator, METH_O, (char *)"ConnectionsSynapseVector_get_allocator(self) -> vector< nupic::algorithms::connections::Synapse >::allocator_type"},
	 { (char *)"ConnectionsSynapseVector_begin", (PyCFunction)_wrap_ConnectionsSynapseVector_begin, METH_O, (char *)"ConnectionsSynapseVector_begin(self) -> vector< nupic::algorithms::connections::Synapse >::iterator"},
	 { (char *)"ConnectionsSynapseVector_end", (PyCFunction)_wrap_ConnectionsSynapseVector_end, METH_O, (char *)"ConnectionsSynapseVector_end(self) -> vector< nupic::algorithms::connections::Synapse >::iterator"},
	 { (char *)"ConnectionsSynapseVector_rbegin", (PyCFunction)_wrap_ConnectionsSynapseVector_rbegin, METH_O, (char *)"ConnectionsSynapseVector_rbegin(self) -> vector< nupic::algorithms::connections::Synapse >::reverse_iterator"},
	 { (char *)"ConnectionsSynapseVector_rend", (PyCFunction)_wrap_ConnectionsSynapseVector_rend, METH_O, (char *)"ConnectionsSynapseVector_rend(self) -> vector< nupic::algorithms::connections::Synapse >::reverse_iterator"},
	 { (char *)"ConnectionsSynapseVector_pop_back", (PyCFunction)_wrap_ConnectionsSynapseVector_pop_back, METH_O, (char *)"ConnectionsSynapseVector_pop_back(self)"},
	 { (char *)"ConnectionsSynapseVector_erase", _wrap_ConnectionsSynapseVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> vector< nupic::algorithms::connections::Synapse >::iterator\n"
		"ConnectionsSynapseVector_erase(self, first, last) -> vector< nupic::algorithms::connections::Synapse >::iterator\n"
		""},
	 { (char *)"new_ConnectionsSynapseVector", _wrap_new_ConnectionsSynapseVector, METH_VARARGS, (char *)"\n"
		"ConnectionsSynapseVector()\n"
		"ConnectionsSynapseVector(arg2)\n"
		"ConnectionsSynapseVector(size)\n"
		"new_ConnectionsSynapseVector(size, value) -> ConnectionsSynapseVector\n"
		""},
	 { (char *)"ConnectionsSynapseVector_push_back", (PyCFunction) _wrap_ConnectionsSynapseVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector_push_back(self, x)"},
	 { (char *)"ConnectionsSynapseVector_front", (PyCFunction)_wrap_ConnectionsSynapseVector_front, METH_O, (char *)"ConnectionsSynapseVector_front(self) -> ConnectionsSynapse"},
	 { (char *)"ConnectionsSynapseVector_back", (PyCFunction)_wrap_ConnectionsSynapseVector_back, METH_O, (char *)"ConnectionsSynapseVector_back(self) -> ConnectionsSynapse"},
	 { (char *)"ConnectionsSynapseVector_assign", (PyCFunction) _wrap_ConnectionsSynapseVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector_assign(self, n, x)"},
	 { (char *)"ConnectionsSynapseVector_resize", _wrap_ConnectionsSynapseVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"ConnectionsSynapseVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"ConnectionsSynapseVector_insert", _wrap_ConnectionsSynapseVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> vector< nupic::algorithms::connections::Synapse >::iterator\n"
		"ConnectionsSynapseVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"ConnectionsSynapseVector_reserve", (PyCFunction) _wrap_ConnectionsSynapseVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapseVector_reserve(self, n)"},
	 { (char *)"ConnectionsSynapseVector_capacity", (PyCFunction)_wrap_ConnectionsSynapseVector_capacity, METH_O, (char *)"ConnectionsSynapseVector_capacity(self) -> vector< nupic::algorithms::connections::Synapse >::size_type"},
	 { (char *)"delete_ConnectionsSynapseVector", (PyCFunction)_wrap_delete_ConnectionsSynapseVector, METH_O, (char *)"delete_ConnectionsSynapseVector(self)"},
	 { (char *)"ConnectionsSynapseVector_swigregister", ConnectionsSynapseVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsSegmentVector_iterator", (PyCFunction)_wrap_ConnectionsSegmentVector_iterator, METH_O, (char *)"ConnectionsSegmentVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"ConnectionsSegmentVector___nonzero__", (PyCFunction)_wrap_ConnectionsSegmentVector___nonzero__, METH_O, (char *)"ConnectionsSegmentVector___nonzero__(self) -> bool"},
	 { (char *)"ConnectionsSegmentVector___bool__", (PyCFunction)_wrap_ConnectionsSegmentVector___bool__, METH_O, (char *)"ConnectionsSegmentVector___bool__(self) -> bool"},
	 { (char *)"ConnectionsSegmentVector___len__", (PyCFunction)_wrap_ConnectionsSegmentVector___len__, METH_O, (char *)"ConnectionsSegmentVector___len__(self) -> vector< nupic::algorithms::connections::Segment >::size_type"},
	 { (char *)"ConnectionsSegmentVector_pop", (PyCFunction)_wrap_ConnectionsSegmentVector_pop, METH_O, (char *)"ConnectionsSegmentVector_pop(self) -> ConnectionsSegment"},
	 { (char *)"ConnectionsSegmentVector___getslice__", (PyCFunction) _wrap_ConnectionsSegmentVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector___getslice__(self, i, j) -> std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *"},
	 { (char *)"ConnectionsSegmentVector___setslice__", (PyCFunction) _wrap_ConnectionsSegmentVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector___setslice__(self, i, j, v=std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >())"},
	 { (char *)"ConnectionsSegmentVector___delslice__", (PyCFunction) _wrap_ConnectionsSegmentVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector___delslice__(self, i, j)"},
	 { (char *)"ConnectionsSegmentVector___delitem__", _wrap_ConnectionsSegmentVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"ConnectionsSegmentVector___delitem__(self, slice)\n"
		""},
	 { (char *)"ConnectionsSegmentVector___getitem__", _wrap_ConnectionsSegmentVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >\n"
		"ConnectionsSegmentVector___getitem__(self, i) -> ConnectionsSegment\n"
		""},
	 { (char *)"ConnectionsSegmentVector___setitem__", _wrap_ConnectionsSegmentVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"ConnectionsSegmentVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"ConnectionsSegmentVector_append", (PyCFunction) _wrap_ConnectionsSegmentVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector_append(self, x)"},
	 { (char *)"ConnectionsSegmentVector_empty", (PyCFunction)_wrap_ConnectionsSegmentVector_empty, METH_O, (char *)"ConnectionsSegmentVector_empty(self) -> bool"},
	 { (char *)"ConnectionsSegmentVector_size", (PyCFunction)_wrap_ConnectionsSegmentVector_size, METH_O, (char *)"ConnectionsSegmentVector_size(self) -> vector< nupic::algorithms::connections::Segment >::size_type"},
	 { (char *)"ConnectionsSegmentVector_clear", (PyCFunction)_wrap_ConnectionsSegmentVector_clear, METH_O, (char *)"ConnectionsSegmentVector_clear(self)"},
	 { (char *)"ConnectionsSegmentVector_swap", (PyCFunction) _wrap_ConnectionsSegmentVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector_swap(self, v)"},
	 { (char *)"ConnectionsSegmentVector_get_allocator", (PyCFunction)_wrap_ConnectionsSegmentVector_get_allocator, METH_O, (char *)"ConnectionsSegmentVector_get_allocator(self) -> vector< nupic::algorithms::connections::Segment >::allocator_type"},
	 { (char *)"ConnectionsSegmentVector_begin", (PyCFunction)_wrap_ConnectionsSegmentVector_begin, METH_O, (char *)"ConnectionsSegmentVector_begin(self) -> vector< nupic::algorithms::connections::Segment >::iterator"},
	 { (char *)"ConnectionsSegmentVector_end", (PyCFunction)_wrap_ConnectionsSegmentVector_end, METH_O, (char *)"ConnectionsSegmentVector_end(self) -> vector< nupic::algorithms::connections::Segment >::iterator"},
	 { (char *)"ConnectionsSegmentVector_rbegin", (PyCFunction)_wrap_ConnectionsSegmentVector_rbegin, METH_O, (char *)"ConnectionsSegmentVector_rbegin(self) -> vector< nupic::algorithms::connections::Segment >::reverse_iterator"},
	 { (char *)"ConnectionsSegmentVector_rend", (PyCFunction)_wrap_ConnectionsSegmentVector_rend, METH_O, (char *)"ConnectionsSegmentVector_rend(self) -> vector< nupic::algorithms::connections::Segment >::reverse_iterator"},
	 { (char *)"ConnectionsSegmentVector_pop_back", (PyCFunction)_wrap_ConnectionsSegmentVector_pop_back, METH_O, (char *)"ConnectionsSegmentVector_pop_back(self)"},
	 { (char *)"ConnectionsSegmentVector_erase", _wrap_ConnectionsSegmentVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> vector< nupic::algorithms::connections::Segment >::iterator\n"
		"ConnectionsSegmentVector_erase(self, first, last) -> vector< nupic::algorithms::connections::Segment >::iterator\n"
		""},
	 { (char *)"new_ConnectionsSegmentVector", _wrap_new_ConnectionsSegmentVector, METH_VARARGS, (char *)"\n"
		"ConnectionsSegmentVector()\n"
		"ConnectionsSegmentVector(arg2)\n"
		"ConnectionsSegmentVector(size)\n"
		"new_ConnectionsSegmentVector(size, value) -> ConnectionsSegmentVector\n"
		""},
	 { (char *)"ConnectionsSegmentVector_push_back", (PyCFunction) _wrap_ConnectionsSegmentVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector_push_back(self, x)"},
	 { (char *)"ConnectionsSegmentVector_front", (PyCFunction)_wrap_ConnectionsSegmentVector_front, METH_O, (char *)"ConnectionsSegmentVector_front(self) -> ConnectionsSegment"},
	 { (char *)"ConnectionsSegmentVector_back", (PyCFunction)_wrap_ConnectionsSegmentVector_back, METH_O, (char *)"ConnectionsSegmentVector_back(self) -> ConnectionsSegment"},
	 { (char *)"ConnectionsSegmentVector_assign", (PyCFunction) _wrap_ConnectionsSegmentVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector_assign(self, n, x)"},
	 { (char *)"ConnectionsSegmentVector_resize", _wrap_ConnectionsSegmentVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"ConnectionsSegmentVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"ConnectionsSegmentVector_insert", _wrap_ConnectionsSegmentVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> vector< nupic::algorithms::connections::Segment >::iterator\n"
		"ConnectionsSegmentVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"ConnectionsSegmentVector_reserve", (PyCFunction) _wrap_ConnectionsSegmentVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegmentVector_reserve(self, n)"},
	 { (char *)"ConnectionsSegmentVector_capacity", (PyCFunction)_wrap_ConnectionsSegmentVector_capacity, METH_O, (char *)"ConnectionsSegmentVector_capacity(self) -> vector< nupic::algorithms::connections::Segment >::size_type"},
	 { (char *)"delete_ConnectionsSegmentVector", (PyCFunction)_wrap_delete_ConnectionsSegmentVector, METH_O, (char *)"delete_ConnectionsSegmentVector(self)"},
	 { (char *)"ConnectionsSegmentVector_swigregister", ConnectionsSegmentVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsCellVector_iterator", (PyCFunction)_wrap_ConnectionsCellVector_iterator, METH_O, (char *)"ConnectionsCellVector_iterator(self) -> SwigPyIterator"},
	 { (char *)"ConnectionsCellVector___nonzero__", (PyCFunction)_wrap_ConnectionsCellVector___nonzero__, METH_O, (char *)"ConnectionsCellVector___nonzero__(self) -> bool"},
	 { (char *)"ConnectionsCellVector___bool__", (PyCFunction)_wrap_ConnectionsCellVector___bool__, METH_O, (char *)"ConnectionsCellVector___bool__(self) -> bool"},
	 { (char *)"ConnectionsCellVector___len__", (PyCFunction)_wrap_ConnectionsCellVector___len__, METH_O, (char *)"ConnectionsCellVector___len__(self) -> vector< nupic::algorithms::connections::Cell >::size_type"},
	 { (char *)"ConnectionsCellVector_pop", (PyCFunction)_wrap_ConnectionsCellVector_pop, METH_O, (char *)"ConnectionsCellVector_pop(self) -> ConnectionsCell"},
	 { (char *)"ConnectionsCellVector___getslice__", (PyCFunction) _wrap_ConnectionsCellVector___getslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector___getslice__(self, i, j) -> std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *"},
	 { (char *)"ConnectionsCellVector___setslice__", (PyCFunction) _wrap_ConnectionsCellVector___setslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector___setslice__(self, i, j, v=std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >())"},
	 { (char *)"ConnectionsCellVector___delslice__", (PyCFunction) _wrap_ConnectionsCellVector___delslice__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector___delslice__(self, i, j)"},
	 { (char *)"ConnectionsCellVector___delitem__", _wrap_ConnectionsCellVector___delitem__, METH_VARARGS, (char *)"\n"
		"__delitem__(i)\n"
		"ConnectionsCellVector___delitem__(self, slice)\n"
		""},
	 { (char *)"ConnectionsCellVector___getitem__", _wrap_ConnectionsCellVector___getitem__, METH_VARARGS, (char *)"\n"
		"__getitem__(slice) -> std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >\n"
		"ConnectionsCellVector___getitem__(self, i) -> ConnectionsCell\n"
		""},
	 { (char *)"ConnectionsCellVector___setitem__", _wrap_ConnectionsCellVector___setitem__, METH_VARARGS, (char *)"\n"
		"__setitem__(slice, v)\n"
		"__setitem__(slice)\n"
		"ConnectionsCellVector___setitem__(self, i, x)\n"
		""},
	 { (char *)"ConnectionsCellVector_append", (PyCFunction) _wrap_ConnectionsCellVector_append, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector_append(self, x)"},
	 { (char *)"ConnectionsCellVector_empty", (PyCFunction)_wrap_ConnectionsCellVector_empty, METH_O, (char *)"ConnectionsCellVector_empty(self) -> bool"},
	 { (char *)"ConnectionsCellVector_size", (PyCFunction)_wrap_ConnectionsCellVector_size, METH_O, (char *)"ConnectionsCellVector_size(self) -> vector< nupic::algorithms::connections::Cell >::size_type"},
	 { (char *)"ConnectionsCellVector_clear", (PyCFunction)_wrap_ConnectionsCellVector_clear, METH_O, (char *)"ConnectionsCellVector_clear(self)"},
	 { (char *)"ConnectionsCellVector_swap", (PyCFunction) _wrap_ConnectionsCellVector_swap, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector_swap(self, v)"},
	 { (char *)"ConnectionsCellVector_get_allocator", (PyCFunction)_wrap_ConnectionsCellVector_get_allocator, METH_O, (char *)"ConnectionsCellVector_get_allocator(self) -> vector< nupic::algorithms::connections::Cell >::allocator_type"},
	 { (char *)"ConnectionsCellVector_begin", (PyCFunction)_wrap_ConnectionsCellVector_begin, METH_O, (char *)"ConnectionsCellVector_begin(self) -> vector< nupic::algorithms::connections::Cell >::iterator"},
	 { (char *)"ConnectionsCellVector_end", (PyCFunction)_wrap_ConnectionsCellVector_end, METH_O, (char *)"ConnectionsCellVector_end(self) -> vector< nupic::algorithms::connections::Cell >::iterator"},
	 { (char *)"ConnectionsCellVector_rbegin", (PyCFunction)_wrap_ConnectionsCellVector_rbegin, METH_O, (char *)"ConnectionsCellVector_rbegin(self) -> vector< nupic::algorithms::connections::Cell >::reverse_iterator"},
	 { (char *)"ConnectionsCellVector_rend", (PyCFunction)_wrap_ConnectionsCellVector_rend, METH_O, (char *)"ConnectionsCellVector_rend(self) -> vector< nupic::algorithms::connections::Cell >::reverse_iterator"},
	 { (char *)"ConnectionsCellVector_pop_back", (PyCFunction)_wrap_ConnectionsCellVector_pop_back, METH_O, (char *)"ConnectionsCellVector_pop_back(self)"},
	 { (char *)"ConnectionsCellVector_erase", _wrap_ConnectionsCellVector_erase, METH_VARARGS, (char *)"\n"
		"erase(pos) -> vector< nupic::algorithms::connections::Cell >::iterator\n"
		"ConnectionsCellVector_erase(self, first, last) -> vector< nupic::algorithms::connections::Cell >::iterator\n"
		""},
	 { (char *)"new_ConnectionsCellVector", _wrap_new_ConnectionsCellVector, METH_VARARGS, (char *)"\n"
		"ConnectionsCellVector()\n"
		"ConnectionsCellVector(arg2)\n"
		"ConnectionsCellVector(size)\n"
		"new_ConnectionsCellVector(size, value) -> ConnectionsCellVector\n"
		""},
	 { (char *)"ConnectionsCellVector_push_back", (PyCFunction) _wrap_ConnectionsCellVector_push_back, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector_push_back(self, x)"},
	 { (char *)"ConnectionsCellVector_front", (PyCFunction)_wrap_ConnectionsCellVector_front, METH_O, (char *)"ConnectionsCellVector_front(self) -> ConnectionsCell"},
	 { (char *)"ConnectionsCellVector_back", (PyCFunction)_wrap_ConnectionsCellVector_back, METH_O, (char *)"ConnectionsCellVector_back(self) -> ConnectionsCell"},
	 { (char *)"ConnectionsCellVector_assign", (PyCFunction) _wrap_ConnectionsCellVector_assign, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector_assign(self, n, x)"},
	 { (char *)"ConnectionsCellVector_resize", _wrap_ConnectionsCellVector_resize, METH_VARARGS, (char *)"\n"
		"resize(new_size)\n"
		"ConnectionsCellVector_resize(self, new_size, x)\n"
		""},
	 { (char *)"ConnectionsCellVector_insert", _wrap_ConnectionsCellVector_insert, METH_VARARGS, (char *)"\n"
		"insert(pos, x) -> vector< nupic::algorithms::connections::Cell >::iterator\n"
		"ConnectionsCellVector_insert(self, pos, n, x)\n"
		""},
	 { (char *)"ConnectionsCellVector_reserve", (PyCFunction) _wrap_ConnectionsCellVector_reserve, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCellVector_reserve(self, n)"},
	 { (char *)"ConnectionsCellVector_capacity", (PyCFunction)_wrap_ConnectionsCellVector_capacity, METH_O, (char *)"ConnectionsCellVector_capacity(self) -> vector< nupic::algorithms::connections::Cell >::size_type"},
	 { (char *)"delete_ConnectionsCellVector", (PyCFunction)_wrap_delete_ConnectionsCellVector, METH_O, (char *)"delete_ConnectionsCellVector(self)"},
	 { (char *)"ConnectionsCellVector_swigregister", ConnectionsCellVector_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsCell_idx_set", _wrap_ConnectionsCell_idx_set, METH_VARARGS, (char *)"ConnectionsCell_idx_set(self, idx)"},
	 { (char *)"ConnectionsCell_idx_get", (PyCFunction)_wrap_ConnectionsCell_idx_get, METH_O, (char *)"ConnectionsCell_idx_get(self) -> nupic::algorithms::connections::CellIdx"},
	 { (char *)"new_ConnectionsCell", _wrap_new_ConnectionsCell, METH_VARARGS, (char *)"\n"
		"Cell(idx)\n"
		"new_ConnectionsCell() -> ConnectionsCell\n"
		""},
	 { (char *)"ConnectionsCell___eq__", (PyCFunction) _wrap_ConnectionsCell___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCell___eq__(self, other) -> bool"},
	 { (char *)"ConnectionsCell___le__", (PyCFunction) _wrap_ConnectionsCell___le__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCell___le__(self, other) -> bool"},
	 { (char *)"ConnectionsCell___lt__", (PyCFunction) _wrap_ConnectionsCell___lt__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCell___lt__(self, other) -> bool"},
	 { (char *)"ConnectionsCell___ge__", (PyCFunction) _wrap_ConnectionsCell___ge__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCell___ge__(self, other) -> bool"},
	 { (char *)"ConnectionsCell___gt__", (PyCFunction) _wrap_ConnectionsCell___gt__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsCell___gt__(self, other) -> bool"},
	 { (char *)"delete_ConnectionsCell", (PyCFunction)_wrap_delete_ConnectionsCell, METH_O, (char *)"delete_ConnectionsCell(self)"},
	 { (char *)"ConnectionsCell_swigregister", ConnectionsCell_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsSegment_idx_set", _wrap_ConnectionsSegment_idx_set, METH_VARARGS, (char *)"ConnectionsSegment_idx_set(self, idx)"},
	 { (char *)"ConnectionsSegment_idx_get", (PyCFunction)_wrap_ConnectionsSegment_idx_get, METH_O, (char *)"ConnectionsSegment_idx_get(self) -> nupic::algorithms::connections::SegmentIdx"},
	 { (char *)"ConnectionsSegment_cell_set", _wrap_ConnectionsSegment_cell_set, METH_VARARGS, (char *)"ConnectionsSegment_cell_set(self, cell)"},
	 { (char *)"ConnectionsSegment_cell_get", (PyCFunction)_wrap_ConnectionsSegment_cell_get, METH_O, (char *)"ConnectionsSegment_cell_get(self) -> ConnectionsCell"},
	 { (char *)"new_ConnectionsSegment", _wrap_new_ConnectionsSegment, METH_VARARGS, (char *)"\n"
		"Segment(idx, cell)\n"
		"new_ConnectionsSegment() -> ConnectionsSegment\n"
		""},
	 { (char *)"ConnectionsSegment___eq__", (PyCFunction) _wrap_ConnectionsSegment___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegment___eq__(self, other) -> bool"},
	 { (char *)"ConnectionsSegment___le__", (PyCFunction) _wrap_ConnectionsSegment___le__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegment___le__(self, other) -> bool"},
	 { (char *)"ConnectionsSegment___lt__", (PyCFunction) _wrap_ConnectionsSegment___lt__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegment___lt__(self, other) -> bool"},
	 { (char *)"ConnectionsSegment___ge__", (PyCFunction) _wrap_ConnectionsSegment___ge__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegment___ge__(self, other) -> bool"},
	 { (char *)"ConnectionsSegment___gt__", (PyCFunction) _wrap_ConnectionsSegment___gt__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSegment___gt__(self, other) -> bool"},
	 { (char *)"delete_ConnectionsSegment", (PyCFunction)_wrap_delete_ConnectionsSegment, METH_O, (char *)"delete_ConnectionsSegment(self)"},
	 { (char *)"ConnectionsSegment_swigregister", ConnectionsSegment_swigregister, METH_VARARGS, NULL},
	 { (char *)"ConnectionsSynapse_idx_set", _wrap_ConnectionsSynapse_idx_set, METH_VARARGS, (char *)"ConnectionsSynapse_idx_set(self, idx)"},
	 { (char *)"ConnectionsSynapse_idx_get", (PyCFunction)_wrap_ConnectionsSynapse_idx_get, METH_O, (char *)"ConnectionsSynapse_idx_get(self) -> nupic::algorithms::connections::SynapseIdx"},
	 { (char *)"ConnectionsSynapse_segment_set", _wrap_ConnectionsSynapse_segment_set, METH_VARARGS, (char *)"ConnectionsSynapse_segment_set(self, segment)"},
	 { (char *)"ConnectionsSynapse_segment_get", (PyCFunction)_wrap_ConnectionsSynapse_segment_get, METH_O, (char *)"ConnectionsSynapse_segment_get(self) -> ConnectionsSegment"},
	 { (char *)"new_ConnectionsSynapse", _wrap_new_ConnectionsSynapse, METH_VARARGS, (char *)"\n"
		"Synapse(idx, segment)\n"
		"new_ConnectionsSynapse() -> ConnectionsSynapse\n"
		""},
	 { (char *)"ConnectionsSynapse___eq__", (PyCFunction) _wrap_ConnectionsSynapse___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"ConnectionsSynapse___eq__(self, other) -> bool"},
	 { (char *)"delete_ConnectionsSynapse", (PyCFunction)_wrap_delete_ConnectionsSynapse, METH_O, (char *)"delete_ConnectionsSynapse(self)"},
	 { (char *)"ConnectionsSynapse_swigregister", ConnectionsSynapse_swigregister, METH_VARARGS, NULL},
	 { (char *)"SynapseData_presynapticCell_set", _wrap_SynapseData_presynapticCell_set, METH_VARARGS, (char *)"SynapseData_presynapticCell_set(self, presynapticCell)"},
	 { (char *)"SynapseData_presynapticCell_get", (PyCFunction)_wrap_SynapseData_presynapticCell_get, METH_O, (char *)"SynapseData_presynapticCell_get(self) -> ConnectionsCell"},
	 { (char *)"SynapseData_permanence_set", _wrap_SynapseData_permanence_set, METH_VARARGS, (char *)"SynapseData_permanence_set(self, permanence)"},
	 { (char *)"SynapseData_permanence_get", (PyCFunction)_wrap_SynapseData_permanence_get, METH_O, (char *)"SynapseData_permanence_get(self) -> nupic::algorithms::connections::Permanence"},
	 { (char *)"SynapseData_destroyed_set", _wrap_SynapseData_destroyed_set, METH_VARARGS, (char *)"SynapseData_destroyed_set(self, destroyed)"},
	 { (char *)"SynapseData_destroyed_get", (PyCFunction)_wrap_SynapseData_destroyed_get, METH_O, (char *)"SynapseData_destroyed_get(self) -> bool"},
	 { (char *)"new_SynapseData", (PyCFunction)_wrap_new_SynapseData, METH_NOARGS, (char *)"new_SynapseData() -> SynapseData"},
	 { (char *)"delete_SynapseData", (PyCFunction)_wrap_delete_SynapseData, METH_O, (char *)"delete_SynapseData(self)"},
	 { (char *)"SynapseData_swigregister", SynapseData_swigregister, METH_VARARGS, NULL},
	 { (char *)"SegmentData_synapses_set", _wrap_SegmentData_synapses_set, METH_VARARGS, (char *)"SegmentData_synapses_set(self, synapses)"},
	 { (char *)"SegmentData_synapses_get", (PyCFunction)_wrap_SegmentData_synapses_get, METH_O, (char *)"SegmentData_synapses_get(self) -> std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > const &"},
	 { (char *)"SegmentData_destroyed_set", _wrap_SegmentData_destroyed_set, METH_VARARGS, (char *)"SegmentData_destroyed_set(self, destroyed)"},
	 { (char *)"SegmentData_destroyed_get", (PyCFunction)_wrap_SegmentData_destroyed_get, METH_O, (char *)"SegmentData_destroyed_get(self) -> bool"},
	 { (char *)"SegmentData_lastUsedIteration_set", _wrap_SegmentData_lastUsedIteration_set, METH_VARARGS, (char *)"SegmentData_lastUsedIteration_set(self, lastUsedIteration)"},
	 { (char *)"SegmentData_lastUsedIteration_get", (PyCFunction)_wrap_SegmentData_lastUsedIteration_get, METH_O, (char *)"SegmentData_lastUsedIteration_get(self) -> nupic::algorithms::connections::Iteration"},
	 { (char *)"new_SegmentData", (PyCFunction)_wrap_new_SegmentData, METH_NOARGS, (char *)"new_SegmentData() -> SegmentData"},
	 { (char *)"delete_SegmentData", (PyCFunction)_wrap_delete_SegmentData, METH_O, (char *)"delete_SegmentData(self)"},
	 { (char *)"SegmentData_swigregister", SegmentData_swigregister, METH_VARARGS, NULL},
	 { (char *)"CellData_segments_set", _wrap_CellData_segments_set, METH_VARARGS, (char *)"CellData_segments_set(self, segments)"},
	 { (char *)"CellData_segments_get", (PyCFunction)_wrap_CellData_segments_get, METH_O, (char *)"CellData_segments_get(self) -> std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > const &"},
	 { (char *)"new_CellData", (PyCFunction)_wrap_new_CellData, METH_NOARGS, (char *)"new_CellData() -> CellData"},
	 { (char *)"delete_CellData", (PyCFunction)_wrap_delete_CellData, METH_O, (char *)"delete_CellData(self)"},
	 { (char *)"CellData_swigregister", CellData_swigregister, METH_VARARGS, NULL},
	 { (char *)"Activity_activeSegmentsForCell_set", _wrap_Activity_activeSegmentsForCell_set, METH_VARARGS, (char *)"Activity_activeSegmentsForCell_set(self, activeSegmentsForCell)"},
	 { (char *)"Activity_activeSegmentsForCell_get", (PyCFunction)_wrap_Activity_activeSegmentsForCell_get, METH_O, (char *)"Activity_activeSegmentsForCell_get(self) -> std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > const &"},
	 { (char *)"Activity_numActiveSynapsesForSegment_set", _wrap_Activity_numActiveSynapsesForSegment_set, METH_VARARGS, (char *)"Activity_numActiveSynapsesForSegment_set(self, numActiveSynapsesForSegment)"},
	 { (char *)"Activity_numActiveSynapsesForSegment_get", (PyCFunction)_wrap_Activity_numActiveSynapsesForSegment_get, METH_O, (char *)"Activity_numActiveSynapsesForSegment_get(self) -> std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > const &"},
	 { (char *)"new_Activity", (PyCFunction)_wrap_new_Activity, METH_NOARGS, (char *)"new_Activity() -> Activity"},
	 { (char *)"delete_Activity", (PyCFunction)_wrap_delete_Activity, METH_O, (char *)"delete_Activity(self)"},
	 { (char *)"Activity_swigregister", Activity_swigregister, METH_VARARGS, NULL},
	 { (char *)"new_Connections", _wrap_new_Connections, METH_VARARGS, (char *)"\n"
		"Connections()\n"
		"new_Connections(numCells, maxSegmentsPerCell=(UCHAR_MAX-1)) -> Connections\n"
		""},
	 { (char *)"delete_Connections", (PyCFunction)_wrap_delete_Connections, METH_O, (char *)"delete_Connections(self)"},
	 { (char *)"Connections_initialize", (PyCFunction) _wrap_Connections_initialize, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_initialize(self, numCells, maxSegmentsPerCell)"},
	 { (char *)"Connections_createSegment", (PyCFunction) _wrap_Connections_createSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_createSegment(self, cell) -> ConnectionsSegment"},
	 { (char *)"Connections_createSynapse", (PyCFunction) _wrap_Connections_createSynapse, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_createSynapse(self, segment, presynapticCell, permanence) -> ConnectionsSynapse"},
	 { (char *)"Connections_destroySegment", (PyCFunction) _wrap_Connections_destroySegment, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_destroySegment(self, segment)"},
	 { (char *)"Connections_destroySynapse", (PyCFunction) _wrap_Connections_destroySynapse, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_destroySynapse(self, synapse)"},
	 { (char *)"Connections_updateSynapsePermanence", (PyCFunction) _wrap_Connections_updateSynapsePermanence, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_updateSynapsePermanence(self, synapse, permanence)"},
	 { (char *)"Connections_segmentsForCell", (PyCFunction) _wrap_Connections_segmentsForCell, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_segmentsForCell(self, cell) -> std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >"},
	 { (char *)"Connections_synapsesForSegment", (PyCFunction) _wrap_Connections_synapsesForSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_synapsesForSegment(self, segment) -> std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > >"},
	 { (char *)"Connections_dataForSegment", (PyCFunction) _wrap_Connections_dataForSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_dataForSegment(self, segment) -> SegmentData"},
	 { (char *)"Connections_dataForSynapse", (PyCFunction) _wrap_Connections_dataForSynapse, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_dataForSynapse(self, synapse) -> SynapseData"},
	 { (char *)"Connections_mostActiveSegmentForCells", (PyCFunction) _wrap_Connections_mostActiveSegmentForCells, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_mostActiveSegmentForCells(self, cells, input, synapseThreshold, retSegment) -> bool"},
	 { (char *)"Connections_leastRecentlyUsedSegment", (PyCFunction) _wrap_Connections_leastRecentlyUsedSegment, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_leastRecentlyUsedSegment(self, cell, retSegment) -> bool"},
	 { (char *)"Connections_computeActivity", (PyCFunction) _wrap_Connections_computeActivity, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_computeActivity(self, input, permanenceThreshold, synapseThreshold, recordIteration=True) -> Activity"},
	 { (char *)"Connections_activeSegments", (PyCFunction) _wrap_Connections_activeSegments, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_activeSegments(self, activity) -> std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >"},
	 { (char *)"Connections_activeCells", (PyCFunction) _wrap_Connections_activeCells, METH_VARARGS | METH_KEYWORDS, (char *)"Connections_activeCells(self, activity) -> std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > >"},
	 { (char *)"Connections_write", _wrap_Connections_write, METH_VARARGS, (char *)"\n"
		"write(stream)\n"
		"Connections_write(self, proto)\n"
		""},
	 { (char *)"Connections_read", _wrap_Connections_read, METH_VARARGS, (char *)"\n"
		"read(stream)\n"
		"Connections_read(self, proto)\n"
		""},
	 { (char *)"Connections_numSegments", (PyCFunction)_wrap_Connections_numSegments, METH_O, (char *)"Connections_numSegments(self) -> nupic::UInt"},
	 { (char *)"Connections_numSynapses", (PyCFunction)_wrap_Connections_numSynapses, METH_O, (char *)"Connections_numSynapses(self) -> nupic::UInt"},
	 { (char *)"Connections___eq__", (PyCFunction) _wrap_Connections___eq__, METH_VARARGS | METH_KEYWORDS, (char *)"Connections___eq__(self, other) -> bool"},
	 { (char *)"Connections_swigregister", Connections_swigregister, METH_VARARGS, NULL},
	 { NULL, NULL, 0, NULL }
};


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

static void *_p_nupic__algorithms__Cells4__CStateIndexedTo_p_nupic__algorithms__Cells4__CState(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((nupic::algorithms::Cells4::CState *)  ((nupic::algorithms::Cells4::CStateIndexed *) x));
}
static void *_p_nupic__ByteVectorTo_p_std__vectorT_char_std__allocatorT_char_t_t(void *x, int *SWIGUNUSEDPARM(newmemory)) {
    return (void *)((std::vector< char,std::allocator< char > > *)  ((nupic::ByteVector *) x));
}
static swig_type_info _swigt__p_ClaClassifierProto__Builder = {"_p_ClaClassifierProto__Builder", "ClaClassifierProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ClaClassifierProto__Reader = {"_p_ClaClassifierProto__Reader", "ClaClassifierProto::Reader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ConnectionsProto__Builder = {"_p_ConnectionsProto__Builder", "ConnectionsProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ConnectionsProto__Reader = {"_p_ConnectionsProto__Reader", "ConnectionsProto::Reader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ErosionT_float_t = {"_p_ErosionT_float_t", "Erosion< float > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_IJV = {"_p_IJV", "IJV *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_InSynapse = {"_p_InSynapse", "InSynapse *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_InSynapses = {"_p_InSynapses", "InSynapses *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_NTA_BasicType = {"_p_NTA_BasicType", "enum NTA_BasicType *|NTA_BasicType *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_NTA_LogLevel = {"_p_NTA_LogLevel", "enum NTA_LogLevel *|NTA_LogLevel *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_OutSynapses = {"_p_OutSynapses", "OutSynapses *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Rotation45T_float_t = {"_p_Rotation45T_float_t", "Rotation45< float > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Row = {"_p_Row", "Row *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SegmentUpdates = {"_p_SegmentUpdates", "SegmentUpdates *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SeparableConvolution2DT_float_t = {"_p_SeparableConvolution2DT_float_t", "SeparableConvolution2D< float > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SpatialPoolerProto__Builder = {"_p_SpatialPoolerProto__Builder", "SpatialPoolerProto::Builder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SpatialPoolerProto__Reader = {"_p_SpatialPoolerProto__Reader", "SpatialPoolerProto::Reader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_argument_type = {"_p_argument_type", "argument_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *|nupic::Byte *|NTA_Byte *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_const_iterator = {"_p_const_iterator", "const_iterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_double = {"_p_double", "double *|NTA_Real64 *|nupic::Real64 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_feature_type = {"_p_feature_type", "feature_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_first_type = {"_p_first_type", "first_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_float = {"_p_float", "NTA_Real *|float *|nupic::algorithms::connections::Permanence *|NTA_Real32 *|nupic::Real *|nupic::Real32 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|nupic::Int32 *|NTA_Int32 *|nupic::Int *|NTA_Int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_istream = {"_p_istream", "istream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_kernel_type = {"_p_kernel_type", "kernel_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_key_type = {"_p_key_type", "key_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_label_type = {"_p_label_type", "label_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long = {"_p_long", "nupic::Int64 *|NTA_Int64 *|long *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_mapped_type = {"_p_mapped_type", "mapped_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__ByteVector = {"_p_nupic__ByteVector", "nupic::ByteVector *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__CState = {"_p_nupic__algorithms__Cells4__CState", "nupic::algorithms::Cells4::CState *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__CStateIndexed = {"_p_nupic__algorithms__Cells4__CStateIndexed", "nupic::algorithms::Cells4::CStateIndexed *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__Cell = {"_p_nupic__algorithms__Cells4__Cell", "nupic::algorithms::Cells4::Cell *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__Cells4 = {"_p_nupic__algorithms__Cells4__Cells4", "nupic::algorithms::Cells4::Cells4 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__InSynapse = {"_p_nupic__algorithms__Cells4__InSynapse", "nupic::algorithms::Cells4::InSynapse *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__InSynapseOrder = {"_p_nupic__algorithms__Cells4__InSynapseOrder", "nupic::algorithms::Cells4::InSynapseOrder *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__OutSynapse = {"_p_nupic__algorithms__Cells4__OutSynapse", "nupic::algorithms::Cells4::OutSynapse *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__Segment = {"_p_nupic__algorithms__Cells4__Segment", "nupic::algorithms::Cells4::Segment *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__Cells4__SegmentUpdate = {"_p_nupic__algorithms__Cells4__SegmentUpdate", "nupic::algorithms::Cells4::SegmentUpdate *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__cla_classifier__ClassifierResult = {"_p_nupic__algorithms__cla_classifier__ClassifierResult", "nupic::algorithms::cla_classifier::ClassifierResult *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__cla_classifier__FastCLAClassifier = {"_p_nupic__algorithms__cla_classifier__FastCLAClassifier", "nupic::algorithms::cla_classifier::FastCLAClassifier *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__Activity = {"_p_nupic__algorithms__connections__Activity", "nupic::algorithms::connections::Activity *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__Cell = {"_p_nupic__algorithms__connections__Cell", "nupic::algorithms::connections::Cell *|vector< nupic::algorithms::connections::Cell >::value_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__CellData = {"_p_nupic__algorithms__connections__CellData", "nupic::algorithms::connections::CellData *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__Connections = {"_p_nupic__algorithms__connections__Connections", "nupic::algorithms::connections::Connections *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__Segment = {"_p_nupic__algorithms__connections__Segment", "nupic::algorithms::connections::Segment *|vector< nupic::algorithms::connections::Segment >::value_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__SegmentData = {"_p_nupic__algorithms__connections__SegmentData", "nupic::algorithms::connections::SegmentData *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__Synapse = {"_p_nupic__algorithms__connections__Synapse", "nupic::algorithms::connections::Synapse *|vector< nupic::algorithms::connections::Synapse >::value_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__connections__SynapseData = {"_p_nupic__algorithms__connections__SynapseData", "nupic::algorithms::connections::SynapseData *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__TRON = {"_p_nupic__algorithms__linear__TRON", "nupic::algorithms::linear::TRON *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__feature_node = {"_p_nupic__algorithms__linear__feature_node", "nupic::algorithms::linear::feature_node *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__function = {"_p_nupic__algorithms__linear__function", "nupic::algorithms::linear::function *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__linear = {"_p_nupic__algorithms__linear__linear", "nupic::algorithms::linear::linear *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__model = {"_p_nupic__algorithms__linear__model", "nupic::algorithms::linear::model *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__parameter = {"_p_nupic__algorithms__linear__parameter", "nupic::algorithms::linear::parameter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__problem = {"_p_nupic__algorithms__linear__problem", "nupic::algorithms::linear::problem *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__linear__sparse_feature_vector = {"_p_nupic__algorithms__linear__sparse_feature_vector", "nupic::algorithms::linear::sparse_feature_vector *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__spatial_pooler__SpatialPooler = {"_p_nupic__algorithms__spatial_pooler__SpatialPooler", "nupic::algorithms::spatial_pooler::SpatialPooler *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__QMatrix = {"_p_nupic__algorithms__svm__QMatrix", "nupic::algorithms::svm::QMatrix *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__QMatrix01 = {"_p_nupic__algorithms__svm__QMatrix01", "nupic::algorithms::svm::QMatrix01 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__decision_function = {"_p_nupic__algorithms__svm__decision_function", "nupic::algorithms::svm::decision_function *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__sampleT_float_float_t = {"_p_nupic__algorithms__svm__sampleT_float_float_t", "nupic::algorithms::svm::svm_problem::sample_type *|nupic::algorithms::svm::sample< float,float > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__sampleT_float_int_t = {"_p_nupic__algorithms__svm__sampleT_float_int_t", "nupic::algorithms::svm::svm_problem01::sample_type *|nupic::algorithms::svm::sample< float,int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_01 = {"_p_nupic__algorithms__svm__svm_01", "nupic::algorithms::svm::svm_01 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_01_traits = {"_p_nupic__algorithms__svm__svm_01_traits", "nupic::algorithms::svm::svm_01_traits *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_dense = {"_p_nupic__algorithms__svm__svm_dense", "nupic::algorithms::svm::svm_dense *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_model = {"_p_nupic__algorithms__svm__svm_model", "nupic::algorithms::svm::svm_model *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_parameter = {"_p_nupic__algorithms__svm__svm_parameter", "nupic::algorithms::svm::svm_parameter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_problem = {"_p_nupic__algorithms__svm__svm_problem", "nupic::algorithms::svm::svm_problem *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_problem01 = {"_p_nupic__algorithms__svm__svm_problem01", "nupic::algorithms::svm::svm_problem01 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nupic__algorithms__svm__svm_std_traits = {"_p_nupic__algorithms__svm__svm_std_traits", "nupic::algorithms::svm::svm_std_traits *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_nz_index_type = {"_p_nz_index_type", "nz_index_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ostream = {"_p_ostream", "ostream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_PyObject = {"_p_p_PyObject", "PyObject **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **|nupic::Byte **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_float = {"_p_p_float", "float **|nupic::Real **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_nupic__algorithms__linear__feature_node = {"_p_p_nupic__algorithms__linear__feature_node", "nupic::algorithms::linear::feature_node **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_void = {"_p_p_void", "nupic::Handle *|void **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_parent_type = {"_p_parent_type", "parent_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_prec_value_type = {"_p_prec_value_type", "prec_value_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_problem_type = {"_p_problem_type", "problem_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_q_matrix_type = {"_p_q_matrix_type", "q_matrix_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_result_type = {"_p_result_type", "result_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_sample_type = {"_p_sample_type", "sample_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_second_type = {"_p_second_type", "second_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_self_type = {"_p_self_type", "self_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "NTA_Int16 *|nupic::Int16 *|short *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_size_t = {"_p_size_t", "nupic::Size *|size_t *|NTA_Size *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_char_t = {"_p_std__allocatorT_char_t", "std::vector< char >::allocator_type *|std::allocator< char > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_nupic__algorithms__connections__Cell_t = {"_p_std__allocatorT_nupic__algorithms__connections__Cell_t", "std::allocator< nupic::algorithms::connections::Cell > *|vector< nupic::algorithms::connections::Cell >::allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_nupic__algorithms__connections__Segment_t = {"_p_std__allocatorT_nupic__algorithms__connections__Segment_t", "std::allocator< nupic::algorithms::connections::Segment > *|vector< nupic::algorithms::connections::Segment >::allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_nupic__algorithms__connections__Synapse_t = {"_p_std__allocatorT_nupic__algorithms__connections__Synapse_t", "std::allocator< nupic::algorithms::connections::Synapse > *|vector< nupic::algorithms::connections::Synapse >::allocator_type *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__allocatorT_size_t_t = {"_p_std__allocatorT_size_t_t", "std::vector< size_t >::allocator_type *|std::allocator< size_t > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t = {"_p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t", "std::deque< std::vector< nupic::UInt,std::allocator< nupic::UInt > > > *|std::deque< std::vector< unsigned int,std::allocator< unsigned int > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__istream = {"_p_std__istream", "std::istream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t = {"_p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t", "std::map< nupic::algorithms::connections::Cell,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > >,std::less< nupic::algorithms::connections::Cell >,std::allocator< std::pair< nupic::algorithms::connections::Cell const,std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t = {"_p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t", "std::map< nupic::algorithms::connections::Segment,unsigned char,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,unsigned char > > > *|std::map< nupic::algorithms::connections::Segment,nupic::algorithms::connections::SynapseIdx,std::less< nupic::algorithms::connections::Segment >,std::allocator< std::pair< nupic::algorithms::connections::Segment const,nupic::algorithms::connections::SynapseIdx > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__ostream = {"_p_std__ostream", "std::ostream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t = {"_p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t", "std::set< unsigned int,std::less< unsigned int >,std::allocator< unsigned int > > *|std::set< nupic::UInt,std::less< nupic::UInt >,std::allocator< nupic::UInt > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t = {"_p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t", "std::vector< InSynapse,std::allocator< nupic::algorithms::Cells4::InSynapse > > *|nupic::algorithms::Cells4::Segment::InSynapses *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_char_std__allocatorT_char_t_t = {"_p_std__vectorT_char_std__allocatorT_char_t_t", "std::vector< nupic::Byte > *|std::vector< char > *|std::vector< char,std::allocator< char > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_float_p_std__allocatorT_float_p_t_t = {"_p_std__vectorT_float_p_std__allocatorT_float_p_t_t", "std::vector< float *,std::allocator< float * > > *|std::vector< nupic::algorithms::svm::svm_problem::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem::feature_type * > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_float_std__allocatorT_float_t_t = {"_p_std__vectorT_float_std__allocatorT_float_t_t", "std::vector< float > *|std::vector< float,std::allocator< float > > *|std::vector< nupic::Real > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_int_p_std__allocatorT_int_p_t_t = {"_p_std__vectorT_int_p_std__allocatorT_int_p_t_t", "std::vector< int *,std::allocator< int * > > *|std::vector< nupic::algorithms::svm::svm_problem01::feature_type *,std::allocator< nupic::algorithms::svm::svm_problem01::feature_type * > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t = {"_p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t", "std::vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *|std::vector< nupic::algorithms::connections::Cell > *|vector< nupic::algorithms::connections::Cell > *|vector< nupic::algorithms::connections::Cell,std::allocator< nupic::algorithms::connections::Cell > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t = {"_p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t", "std::vector< nupic::algorithms::connections::SegmentData,std::allocator< nupic::algorithms::connections::SegmentData > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t = {"_p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t", "vector< nupic::algorithms::connections::Segment > *|std::vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *|std::vector< nupic::algorithms::connections::Segment > *|vector< nupic::algorithms::connections::Segment,std::allocator< nupic::algorithms::connections::Segment > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t = {"_p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t", "std::vector< nupic::algorithms::connections::SynapseData,std::allocator< nupic::algorithms::connections::SynapseData > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t = {"_p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t", "std::vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *|std::vector< nupic::algorithms::connections::Synapse > *|vector< nupic::algorithms::connections::Synapse,std::allocator< nupic::algorithms::connections::Synapse > > *|vector< nupic::algorithms::connections::Synapse > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_size_t_std__allocatorT_size_t_t_t = {"_p_std__vectorT_size_t_std__allocatorT_size_t_t_t", "std::vector< size_t,std::allocator< size_t > > *|std::vector< size_t > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t = {"_p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t", "std::vector< std::pair< unsigned int,float > > *|std::vector< std::pair< nupic::UInt,nupic::Real > > *|std::vector< std::pair< nupic::UInt32,nupic::Real32 >,std::allocator< std::pair< nupic::UInt32,nupic::Real32 > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t = {"_p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t", "std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > *|std::vector< std::vector< NTA_Real32,std::allocator< NTA_Real32 > >,std::allocator< std::vector< NTA_Real32,std::allocator< NTA_Real32 > > > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t = {"_p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t", "std::vector< std::vector< NTA_UInt32,std::allocator< NTA_UInt32 > >,std::allocator< std::vector< NTA_UInt32,std::allocator< NTA_UInt32 > > > > *|std::vector< std::vector< unsigned int > > *|std::vector< std::vector< nupic::UInt > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t = {"_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t", "std::vector< nupic::UInt,std::allocator< nupic::UInt > > *|TIV *|std::vector< unsigned int,std::allocator< unsigned int > > *|std::vector< unsigned int > *|std::vector< nupic::UInt > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig__SwigPyIterator = {"_p_swig__SwigPyIterator", "swig::SwigPyIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_uintptr_t = {"_p_uintptr_t", "uintptr_t *|NTA_UIntPtr *|nupic::UIntPtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "nupic::algorithms::connections::SynapseIdx *|unsigned char *|nupic::algorithms::Cells4::UChar *|nupic::algorithms::connections::SegmentIdx *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "NTA_UInt *|NTA_UInt32 *|nupic::algorithms::connections::CellIdx *|nupic::UInt32 *|unsigned int *|nupic::UInt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "NTA_UInt64 *|nupic::UInt64 *|nupic::algorithms::connections::Iteration *|unsigned long *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "nupic::UInt16 *|NTA_UInt16 *|unsigned short *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_ClaClassifierProto__Builder,
  &_swigt__p_ClaClassifierProto__Reader,
  &_swigt__p_ConnectionsProto__Builder,
  &_swigt__p_ConnectionsProto__Reader,
  &_swigt__p_ErosionT_float_t,
  &_swigt__p_IJV,
  &_swigt__p_InSynapse,
  &_swigt__p_InSynapses,
  &_swigt__p_NTA_BasicType,
  &_swigt__p_NTA_LogLevel,
  &_swigt__p_OutSynapses,
  &_swigt__p_Rotation45T_float_t,
  &_swigt__p_Row,
  &_swigt__p_SegmentUpdates,
  &_swigt__p_SeparableConvolution2DT_float_t,
  &_swigt__p_SpatialPoolerProto__Builder,
  &_swigt__p_SpatialPoolerProto__Reader,
  &_swigt__p_allocator_type,
  &_swigt__p_argument_type,
  &_swigt__p_char,
  &_swigt__p_const_iterator,
  &_swigt__p_difference_type,
  &_swigt__p_double,
  &_swigt__p_feature_type,
  &_swigt__p_first_type,
  &_swigt__p_float,
  &_swigt__p_int,
  &_swigt__p_istream,
  &_swigt__p_kernel_type,
  &_swigt__p_key_type,
  &_swigt__p_label_type,
  &_swigt__p_long,
  &_swigt__p_mapped_type,
  &_swigt__p_nupic__ByteVector,
  &_swigt__p_nupic__algorithms__Cells4__CState,
  &_swigt__p_nupic__algorithms__Cells4__CStateIndexed,
  &_swigt__p_nupic__algorithms__Cells4__Cell,
  &_swigt__p_nupic__algorithms__Cells4__Cells4,
  &_swigt__p_nupic__algorithms__Cells4__InSynapse,
  &_swigt__p_nupic__algorithms__Cells4__InSynapseOrder,
  &_swigt__p_nupic__algorithms__Cells4__OutSynapse,
  &_swigt__p_nupic__algorithms__Cells4__Segment,
  &_swigt__p_nupic__algorithms__Cells4__SegmentUpdate,
  &_swigt__p_nupic__algorithms__cla_classifier__ClassifierResult,
  &_swigt__p_nupic__algorithms__cla_classifier__FastCLAClassifier,
  &_swigt__p_nupic__algorithms__connections__Activity,
  &_swigt__p_nupic__algorithms__connections__Cell,
  &_swigt__p_nupic__algorithms__connections__CellData,
  &_swigt__p_nupic__algorithms__connections__Connections,
  &_swigt__p_nupic__algorithms__connections__Segment,
  &_swigt__p_nupic__algorithms__connections__SegmentData,
  &_swigt__p_nupic__algorithms__connections__Synapse,
  &_swigt__p_nupic__algorithms__connections__SynapseData,
  &_swigt__p_nupic__algorithms__linear__TRON,
  &_swigt__p_nupic__algorithms__linear__feature_node,
  &_swigt__p_nupic__algorithms__linear__function,
  &_swigt__p_nupic__algorithms__linear__linear,
  &_swigt__p_nupic__algorithms__linear__model,
  &_swigt__p_nupic__algorithms__linear__parameter,
  &_swigt__p_nupic__algorithms__linear__problem,
  &_swigt__p_nupic__algorithms__linear__sparse_feature_vector,
  &_swigt__p_nupic__algorithms__spatial_pooler__SpatialPooler,
  &_swigt__p_nupic__algorithms__svm__QMatrix,
  &_swigt__p_nupic__algorithms__svm__QMatrix01,
  &_swigt__p_nupic__algorithms__svm__decision_function,
  &_swigt__p_nupic__algorithms__svm__sampleT_float_float_t,
  &_swigt__p_nupic__algorithms__svm__sampleT_float_int_t,
  &_swigt__p_nupic__algorithms__svm__svm_01,
  &_swigt__p_nupic__algorithms__svm__svm_01_traits,
  &_swigt__p_nupic__algorithms__svm__svm_dense,
  &_swigt__p_nupic__algorithms__svm__svm_model,
  &_swigt__p_nupic__algorithms__svm__svm_parameter,
  &_swigt__p_nupic__algorithms__svm__svm_problem,
  &_swigt__p_nupic__algorithms__svm__svm_problem01,
  &_swigt__p_nupic__algorithms__svm__svm_std_traits,
  &_swigt__p_nz_index_type,
  &_swigt__p_ostream,
  &_swigt__p_p_PyObject,
  &_swigt__p_p_char,
  &_swigt__p_p_float,
  &_swigt__p_p_nupic__algorithms__linear__feature_node,
  &_swigt__p_p_void,
  &_swigt__p_parent_type,
  &_swigt__p_prec_value_type,
  &_swigt__p_problem_type,
  &_swigt__p_q_matrix_type,
  &_swigt__p_result_type,
  &_swigt__p_sample_type,
  &_swigt__p_second_type,
  &_swigt__p_self_type,
  &_swigt__p_short,
  &_swigt__p_size_t,
  &_swigt__p_size_type,
  &_swigt__p_std__allocatorT_char_t,
  &_swigt__p_std__allocatorT_nupic__algorithms__connections__Cell_t,
  &_swigt__p_std__allocatorT_nupic__algorithms__connections__Segment_t,
  &_swigt__p_std__allocatorT_nupic__algorithms__connections__Synapse_t,
  &_swigt__p_std__allocatorT_size_t_t,
  &_swigt__p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t,
  &_swigt__p_std__istream,
  &_swigt__p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t,
  &_swigt__p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t,
  &_swigt__p_std__ostream,
  &_swigt__p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t,
  &_swigt__p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t,
  &_swigt__p_std__vectorT_char_std__allocatorT_char_t_t,
  &_swigt__p_std__vectorT_float_p_std__allocatorT_float_p_t_t,
  &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t,
  &_swigt__p_std__vectorT_int_p_std__allocatorT_int_p_t_t,
  &_swigt__p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t,
  &_swigt__p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t,
  &_swigt__p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t,
  &_swigt__p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t,
  &_swigt__p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t,
  &_swigt__p_std__vectorT_size_t_std__allocatorT_size_t_t_t,
  &_swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t,
  &_swigt__p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t,
  &_swigt__p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t,
  &_swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
  &_swigt__p_swig__SwigPyIterator,
  &_swigt__p_uintptr_t,
  &_swigt__p_unsigned_char,
  &_swigt__p_unsigned_int,
  &_swigt__p_unsigned_long,
  &_swigt__p_unsigned_short,
  &_swigt__p_value_type,
};

static swig_cast_info _swigc__p_ClaClassifierProto__Builder[] = {  {&_swigt__p_ClaClassifierProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ClaClassifierProto__Reader[] = {  {&_swigt__p_ClaClassifierProto__Reader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ConnectionsProto__Builder[] = {  {&_swigt__p_ConnectionsProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ConnectionsProto__Reader[] = {  {&_swigt__p_ConnectionsProto__Reader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ErosionT_float_t[] = {  {&_swigt__p_ErosionT_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_IJV[] = {  {&_swigt__p_IJV, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_InSynapse[] = {  {&_swigt__p_InSynapse, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_InSynapses[] = {  {&_swigt__p_InSynapses, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_NTA_BasicType[] = {  {&_swigt__p_NTA_BasicType, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_NTA_LogLevel[] = {  {&_swigt__p_NTA_LogLevel, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_OutSynapses[] = {  {&_swigt__p_OutSynapses, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Rotation45T_float_t[] = {  {&_swigt__p_Rotation45T_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Row[] = {  {&_swigt__p_Row, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SegmentUpdates[] = {  {&_swigt__p_SegmentUpdates, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SeparableConvolution2DT_float_t[] = {  {&_swigt__p_SeparableConvolution2DT_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SpatialPoolerProto__Builder[] = {  {&_swigt__p_SpatialPoolerProto__Builder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SpatialPoolerProto__Reader[] = {  {&_swigt__p_SpatialPoolerProto__Reader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_allocator_type[] = {  {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_argument_type[] = {  {&_swigt__p_argument_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_const_iterator[] = {  {&_swigt__p_const_iterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_difference_type[] = {  {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_feature_type[] = {  {&_swigt__p_feature_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_first_type[] = {  {&_swigt__p_first_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_istream[] = {  {&_swigt__p_istream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_kernel_type[] = {  {&_swigt__p_kernel_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_key_type[] = {  {&_swigt__p_key_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_label_type[] = {  {&_swigt__p_label_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long[] = {  {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_mapped_type[] = {  {&_swigt__p_mapped_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__ByteVector[] = {  {&_swigt__p_nupic__ByteVector, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__CState[] = {  {&_swigt__p_nupic__algorithms__Cells4__CState, 0, 0, 0},  {&_swigt__p_nupic__algorithms__Cells4__CStateIndexed, _p_nupic__algorithms__Cells4__CStateIndexedTo_p_nupic__algorithms__Cells4__CState, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__CStateIndexed[] = {  {&_swigt__p_nupic__algorithms__Cells4__CStateIndexed, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__Cell[] = {  {&_swigt__p_nupic__algorithms__Cells4__Cell, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__Cells4[] = {  {&_swigt__p_nupic__algorithms__Cells4__Cells4, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__InSynapse[] = {  {&_swigt__p_nupic__algorithms__Cells4__InSynapse, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__InSynapseOrder[] = {  {&_swigt__p_nupic__algorithms__Cells4__InSynapseOrder, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__OutSynapse[] = {  {&_swigt__p_nupic__algorithms__Cells4__OutSynapse, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__Segment[] = {  {&_swigt__p_nupic__algorithms__Cells4__Segment, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__Cells4__SegmentUpdate[] = {  {&_swigt__p_nupic__algorithms__Cells4__SegmentUpdate, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__cla_classifier__ClassifierResult[] = {  {&_swigt__p_nupic__algorithms__cla_classifier__ClassifierResult, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__cla_classifier__FastCLAClassifier[] = {  {&_swigt__p_nupic__algorithms__cla_classifier__FastCLAClassifier, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__Activity[] = {  {&_swigt__p_nupic__algorithms__connections__Activity, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__Cell[] = {  {&_swigt__p_nupic__algorithms__connections__Cell, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__CellData[] = {  {&_swigt__p_nupic__algorithms__connections__CellData, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__Connections[] = {  {&_swigt__p_nupic__algorithms__connections__Connections, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__Segment[] = {  {&_swigt__p_nupic__algorithms__connections__Segment, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__SegmentData[] = {  {&_swigt__p_nupic__algorithms__connections__SegmentData, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__Synapse[] = {  {&_swigt__p_nupic__algorithms__connections__Synapse, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__connections__SynapseData[] = {  {&_swigt__p_nupic__algorithms__connections__SynapseData, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__TRON[] = {  {&_swigt__p_nupic__algorithms__linear__TRON, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__feature_node[] = {  {&_swigt__p_nupic__algorithms__linear__feature_node, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__function[] = {  {&_swigt__p_nupic__algorithms__linear__function, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__linear[] = {  {&_swigt__p_nupic__algorithms__linear__linear, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__model[] = {  {&_swigt__p_nupic__algorithms__linear__model, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__parameter[] = {  {&_swigt__p_nupic__algorithms__linear__parameter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__problem[] = {  {&_swigt__p_nupic__algorithms__linear__problem, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__linear__sparse_feature_vector[] = {  {&_swigt__p_nupic__algorithms__linear__sparse_feature_vector, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__spatial_pooler__SpatialPooler[] = {  {&_swigt__p_nupic__algorithms__spatial_pooler__SpatialPooler, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__QMatrix[] = {  {&_swigt__p_nupic__algorithms__svm__QMatrix, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__QMatrix01[] = {  {&_swigt__p_nupic__algorithms__svm__QMatrix01, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__decision_function[] = {  {&_swigt__p_nupic__algorithms__svm__decision_function, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__sampleT_float_float_t[] = {  {&_swigt__p_nupic__algorithms__svm__sampleT_float_float_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__sampleT_float_int_t[] = {  {&_swigt__p_nupic__algorithms__svm__sampleT_float_int_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_01[] = {  {&_swigt__p_nupic__algorithms__svm__svm_01, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_01_traits[] = {  {&_swigt__p_nupic__algorithms__svm__svm_01_traits, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_dense[] = {  {&_swigt__p_nupic__algorithms__svm__svm_dense, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_model[] = {  {&_swigt__p_nupic__algorithms__svm__svm_model, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_parameter[] = {  {&_swigt__p_nupic__algorithms__svm__svm_parameter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_problem[] = {  {&_swigt__p_nupic__algorithms__svm__svm_problem, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_problem01[] = {  {&_swigt__p_nupic__algorithms__svm__svm_problem01, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nupic__algorithms__svm__svm_std_traits[] = {  {&_swigt__p_nupic__algorithms__svm__svm_std_traits, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_nz_index_type[] = {  {&_swigt__p_nz_index_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ostream[] = {  {&_swigt__p_ostream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_PyObject[] = {  {&_swigt__p_p_PyObject, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_float[] = {  {&_swigt__p_p_float, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_nupic__algorithms__linear__feature_node[] = {  {&_swigt__p_p_nupic__algorithms__linear__feature_node, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_void[] = {  {&_swigt__p_p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_parent_type[] = {  {&_swigt__p_parent_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_prec_value_type[] = {  {&_swigt__p_prec_value_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_problem_type[] = {  {&_swigt__p_problem_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_q_matrix_type[] = {  {&_swigt__p_q_matrix_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_result_type[] = {  {&_swigt__p_result_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_sample_type[] = {  {&_swigt__p_sample_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_second_type[] = {  {&_swigt__p_second_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_self_type[] = {  {&_swigt__p_self_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = {  {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_size_t[] = {  {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_size_type[] = {  {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_char_t[] = {  {&_swigt__p_std__allocatorT_char_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_nupic__algorithms__connections__Cell_t[] = {  {&_swigt__p_std__allocatorT_nupic__algorithms__connections__Cell_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_nupic__algorithms__connections__Segment_t[] = {  {&_swigt__p_std__allocatorT_nupic__algorithms__connections__Segment_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_nupic__algorithms__connections__Synapse_t[] = {  {&_swigt__p_std__allocatorT_nupic__algorithms__connections__Synapse_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__allocatorT_size_t_t[] = {  {&_swigt__p_std__allocatorT_size_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t[] = {  {&_swigt__p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__istream[] = {  {&_swigt__p_std__istream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t[] = {  {&_swigt__p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t[] = {  {&_swigt__p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__ostream[] = {  {&_swigt__p_std__ostream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t[] = {  {&_swigt__p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t[] = {  {&_swigt__p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_char_std__allocatorT_char_t_t[] = {  {&_swigt__p_std__vectorT_char_std__allocatorT_char_t_t, 0, 0, 0},  {&_swigt__p_nupic__ByteVector, _p_nupic__ByteVectorTo_p_std__vectorT_char_std__allocatorT_char_t_t, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_float_p_std__allocatorT_float_p_t_t[] = {  {&_swigt__p_std__vectorT_float_p_std__allocatorT_float_p_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_float_std__allocatorT_float_t_t[] = {  {&_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_int_p_std__allocatorT_int_p_t_t[] = {  {&_swigt__p_std__vectorT_int_p_std__allocatorT_int_p_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t[] = {  {&_swigt__p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t[] = {  {&_swigt__p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t[] = {  {&_swigt__p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t[] = {  {&_swigt__p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t[] = {  {&_swigt__p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_size_t_std__allocatorT_size_t_t_t[] = {  {&_swigt__p_std__vectorT_size_t_std__allocatorT_size_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t[] = {  {&_swigt__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t[] = {  {&_swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig__SwigPyIterator[] = {  {&_swigt__p_swig__SwigPyIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_uintptr_t[] = {  {&_swigt__p_uintptr_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long[] = {  {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_short[] = {  {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_value_type[] = {  {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_ClaClassifierProto__Builder,
  _swigc__p_ClaClassifierProto__Reader,
  _swigc__p_ConnectionsProto__Builder,
  _swigc__p_ConnectionsProto__Reader,
  _swigc__p_ErosionT_float_t,
  _swigc__p_IJV,
  _swigc__p_InSynapse,
  _swigc__p_InSynapses,
  _swigc__p_NTA_BasicType,
  _swigc__p_NTA_LogLevel,
  _swigc__p_OutSynapses,
  _swigc__p_Rotation45T_float_t,
  _swigc__p_Row,
  _swigc__p_SegmentUpdates,
  _swigc__p_SeparableConvolution2DT_float_t,
  _swigc__p_SpatialPoolerProto__Builder,
  _swigc__p_SpatialPoolerProto__Reader,
  _swigc__p_allocator_type,
  _swigc__p_argument_type,
  _swigc__p_char,
  _swigc__p_const_iterator,
  _swigc__p_difference_type,
  _swigc__p_double,
  _swigc__p_feature_type,
  _swigc__p_first_type,
  _swigc__p_float,
  _swigc__p_int,
  _swigc__p_istream,
  _swigc__p_kernel_type,
  _swigc__p_key_type,
  _swigc__p_label_type,
  _swigc__p_long,
  _swigc__p_mapped_type,
  _swigc__p_nupic__ByteVector,
  _swigc__p_nupic__algorithms__Cells4__CState,
  _swigc__p_nupic__algorithms__Cells4__CStateIndexed,
  _swigc__p_nupic__algorithms__Cells4__Cell,
  _swigc__p_nupic__algorithms__Cells4__Cells4,
  _swigc__p_nupic__algorithms__Cells4__InSynapse,
  _swigc__p_nupic__algorithms__Cells4__InSynapseOrder,
  _swigc__p_nupic__algorithms__Cells4__OutSynapse,
  _swigc__p_nupic__algorithms__Cells4__Segment,
  _swigc__p_nupic__algorithms__Cells4__SegmentUpdate,
  _swigc__p_nupic__algorithms__cla_classifier__ClassifierResult,
  _swigc__p_nupic__algorithms__cla_classifier__FastCLAClassifier,
  _swigc__p_nupic__algorithms__connections__Activity,
  _swigc__p_nupic__algorithms__connections__Cell,
  _swigc__p_nupic__algorithms__connections__CellData,
  _swigc__p_nupic__algorithms__connections__Connections,
  _swigc__p_nupic__algorithms__connections__Segment,
  _swigc__p_nupic__algorithms__connections__SegmentData,
  _swigc__p_nupic__algorithms__connections__Synapse,
  _swigc__p_nupic__algorithms__connections__SynapseData,
  _swigc__p_nupic__algorithms__linear__TRON,
  _swigc__p_nupic__algorithms__linear__feature_node,
  _swigc__p_nupic__algorithms__linear__function,
  _swigc__p_nupic__algorithms__linear__linear,
  _swigc__p_nupic__algorithms__linear__model,
  _swigc__p_nupic__algorithms__linear__parameter,
  _swigc__p_nupic__algorithms__linear__problem,
  _swigc__p_nupic__algorithms__linear__sparse_feature_vector,
  _swigc__p_nupic__algorithms__spatial_pooler__SpatialPooler,
  _swigc__p_nupic__algorithms__svm__QMatrix,
  _swigc__p_nupic__algorithms__svm__QMatrix01,
  _swigc__p_nupic__algorithms__svm__decision_function,
  _swigc__p_nupic__algorithms__svm__sampleT_float_float_t,
  _swigc__p_nupic__algorithms__svm__sampleT_float_int_t,
  _swigc__p_nupic__algorithms__svm__svm_01,
  _swigc__p_nupic__algorithms__svm__svm_01_traits,
  _swigc__p_nupic__algorithms__svm__svm_dense,
  _swigc__p_nupic__algorithms__svm__svm_model,
  _swigc__p_nupic__algorithms__svm__svm_parameter,
  _swigc__p_nupic__algorithms__svm__svm_problem,
  _swigc__p_nupic__algorithms__svm__svm_problem01,
  _swigc__p_nupic__algorithms__svm__svm_std_traits,
  _swigc__p_nz_index_type,
  _swigc__p_ostream,
  _swigc__p_p_PyObject,
  _swigc__p_p_char,
  _swigc__p_p_float,
  _swigc__p_p_nupic__algorithms__linear__feature_node,
  _swigc__p_p_void,
  _swigc__p_parent_type,
  _swigc__p_prec_value_type,
  _swigc__p_problem_type,
  _swigc__p_q_matrix_type,
  _swigc__p_result_type,
  _swigc__p_sample_type,
  _swigc__p_second_type,
  _swigc__p_self_type,
  _swigc__p_short,
  _swigc__p_size_t,
  _swigc__p_size_type,
  _swigc__p_std__allocatorT_char_t,
  _swigc__p_std__allocatorT_nupic__algorithms__connections__Cell_t,
  _swigc__p_std__allocatorT_nupic__algorithms__connections__Segment_t,
  _swigc__p_std__allocatorT_nupic__algorithms__connections__Synapse_t,
  _swigc__p_std__allocatorT_size_t_t,
  _swigc__p_std__dequeT_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t_t,
  _swigc__p_std__istream,
  _swigc__p_std__mapT_nupic__algorithms__connections__Cell_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_std__lessT_nupic__algorithms__connections__Cell_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Cell_const_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t_t_t_t,
  _swigc__p_std__mapT_nupic__algorithms__connections__Segment_unsigned_char_std__lessT_nupic__algorithms__connections__Segment_t_std__allocatorT_std__pairT_nupic__algorithms__connections__Segment_const_unsigned_char_t_t_t,
  _swigc__p_std__ostream,
  _swigc__p_std__setT_unsigned_int_std__lessT_unsigned_int_t_std__allocatorT_unsigned_int_t_t,
  _swigc__p_std__vectorT_InSynapse_std__allocatorT_nupic__algorithms__Cells4__InSynapse_t_t,
  _swigc__p_std__vectorT_char_std__allocatorT_char_t_t,
  _swigc__p_std__vectorT_float_p_std__allocatorT_float_p_t_t,
  _swigc__p_std__vectorT_float_std__allocatorT_float_t_t,
  _swigc__p_std__vectorT_int_p_std__allocatorT_int_p_t_t,
  _swigc__p_std__vectorT_nupic__algorithms__connections__Cell_std__allocatorT_nupic__algorithms__connections__Cell_t_t,
  _swigc__p_std__vectorT_nupic__algorithms__connections__SegmentData_std__allocatorT_nupic__algorithms__connections__SegmentData_t_t,
  _swigc__p_std__vectorT_nupic__algorithms__connections__Segment_std__allocatorT_nupic__algorithms__connections__Segment_t_t,
  _swigc__p_std__vectorT_nupic__algorithms__connections__SynapseData_std__allocatorT_nupic__algorithms__connections__SynapseData_t_t,
  _swigc__p_std__vectorT_nupic__algorithms__connections__Synapse_std__allocatorT_nupic__algorithms__connections__Synapse_t_t,
  _swigc__p_std__vectorT_size_t_std__allocatorT_size_t_t_t,
  _swigc__p_std__vectorT_std__pairT_nupic__UInt32_nupic__Real32_t_std__allocatorT_std__pairT_nupic__UInt32_nupic__Real32_t_t_t,
  _swigc__p_std__vectorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_std__allocatorT_std__vectorT_NTA_Real32_std__allocatorT_NTA_Real32_t_t_t_t,
  _swigc__p_std__vectorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_std__allocatorT_std__vectorT_NTA_UInt32_std__allocatorT_NTA_UInt32_t_t_t_t,
  _swigc__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
  _swigc__p_swig__SwigPyIterator,
  _swigc__p_uintptr_t,
  _swigc__p_unsigned_char,
  _swigc__p_unsigned_int,
  _swigc__p_unsigned_long,
  _swigc__p_unsigned_short,
  _swigc__p_value_type,
};


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

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

#ifdef __cplusplus
}
#endif
/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic
 * memory is used. Also, since swig_type_info structures store pointers to
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization.
 * The idea is that swig generates all the structures that are needed.
 * The runtime then collects these partially filled structures.
 * The SWIG_InitializeModule function takes these initial arrays out of
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned statically to an initial
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded.
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int found, init;
  
  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
    init = 1;
  } else {
    init = 0;
  }
  
  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
    module_head = &swig_module;
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    found=0;
    iter=module_head;
    do {
      if (iter==&swig_module) {
        found=1;
        break;
      }
      iter=iter->next;
    } while (iter!= module_head);
    
    /* if the is found in the list, then all is done and we may leave */
    if (found) return;
    /* otherwise we must add out module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }
  
  /* When multiple interpreters are used, a module could have already been initialized in
       a different interpreter, but not yet have a pointer in this interpreter.
       In this case, we do not want to continue adding types... everything should be
       set up already */
  if (init == 0) return;
  
  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
    
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
    
    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
        type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }
    
    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
        if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
          cast->type = ret;
          ret = 0;
        } else {
          /* Check for casting already in the list */
          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
          if (!ocast) ret = 0;
        }
      }
      
      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;
  
#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
    printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;
  
  if (init_run) return;
  init_run = 1;
  
  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{
  /* c-mode */
#endif
}
#endif



#ifdef __cplusplus
extern "C" {
#endif
  
  /* Python-specific SWIG API */
#define SWIG_newvarlink()                             SWIG_Python_newvarlink()
#define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
#define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
  
  /* -----------------------------------------------------------------------------
   * 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;
  
  SWIGINTERN PyObject *
  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
#if PY_VERSION_HEX >= 0x03000000
    return PyUnicode_InternFromString("<Swig global variables>");
#else
    return PyString_FromString("<Swig global variables>");
#endif
  }
  
  SWIGINTERN PyObject *
  swig_varlink_str(swig_varlinkobject *v) {
#if PY_VERSION_HEX >= 0x03000000
    PyObject *str = PyUnicode_InternFromString("(");
    PyObject *tail;
    PyObject *joined;
    swig_globalvar *var;
    for (var = v->vars; var; var=var->next) {
      tail = PyUnicode_FromString(var->name);
      joined = PyUnicode_Concat(str, tail);
      Py_DecRef(str);
      Py_DecRef(tail);
      str = joined;
      if (var->next) {
        tail = PyUnicode_InternFromString(", ");
        joined = PyUnicode_Concat(str, tail);
        Py_DecRef(str);
        Py_DecRef(tail);
        str = joined;
      }
    }
    tail = PyUnicode_InternFromString(")");
    joined = PyUnicode_Concat(str, tail);
    Py_DecRef(str);
    Py_DecRef(tail);
    str = joined;
#else
    PyObject *str = PyString_FromString("(");
    swig_globalvar *var;
    for (var = v->vars; var; var=var->next) {
      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
    }
    PyString_ConcatAndDel(&str,PyString_FromString(")"));
#endif
    return str;
  }
  
  SWIGINTERN int
  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
    char *tmp;
    PyObject *str = swig_varlink_str(v);
    fprintf(fp,"Swig global variables ");
    fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
    SWIG_Python_str_DelForPy3(tmp);
    Py_DECREF(str);
    return 0;
  }
  
  SWIGINTERN void
  swig_varlink_dealloc(swig_varlinkobject *v) {
    swig_globalvar *var = v->vars;
    while (var) {
      swig_globalvar *n = var->next;
      free(var->name);
      free(var);
      var = n;
    }
  }
  
  SWIGINTERN PyObject *
  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
    PyObject *res = NULL;
    swig_globalvar *var = v->vars;
    while (var) {
      if (strcmp(var->name,n) == 0) {
        res = (*var->get_attr)();
        break;
      }
      var = var->next;
    }
    if (res == NULL && !PyErr_Occurred()) {
      PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
    }
    return res;
  }
  
  SWIGINTERN int
  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
    int res = 1;
    swig_globalvar *var = v->vars;
    while (var) {
      if (strcmp(var->name,n) == 0) {
        res = (*var->set_attr)(p);
        break;
      }
      var = var->next;
    }
    if (res == 1 && !PyErr_Occurred()) {
      PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
    }
    return res;
  }
  
  SWIGINTERN PyTypeObject*
  swig_varlink_type(void) {
    static char varlink__doc__[] = "Swig var link object";
    static PyTypeObject varlink_type;
    static int type_init = 0;
    if (!type_init) {
      const PyTypeObject tmp = {
        /* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000
        PyVarObject_HEAD_INIT(NULL, 0)
#else
        PyObject_HEAD_INIT(NULL)
        0,                                  /* ob_size */
#endif
        (char *)"swigvarlink",              /* tp_name */
        sizeof(swig_varlinkobject),         /* tp_basicsize */
        0,                                  /* tp_itemsize */
        (destructor) swig_varlink_dealloc,  /* tp_dealloc */
        (printfunc) swig_varlink_print,     /* tp_print */
        (getattrfunc) swig_varlink_getattr, /* tp_getattr */
        (setattrfunc) swig_varlink_setattr, /* tp_setattr */
        0,                                  /* tp_compare */
        (reprfunc) swig_varlink_repr,       /* tp_repr */
        0,                                  /* tp_as_number */
        0,                                  /* tp_as_sequence */
        0,                                  /* tp_as_mapping */
        0,                                  /* tp_hash */
        0,                                  /* tp_call */
        (reprfunc) swig_varlink_str,        /* tp_str */
        0,                                  /* tp_getattro */
        0,                                  /* tp_setattro */
        0,                                  /* tp_as_buffer */
        0,                                  /* tp_flags */
        varlink__doc__,                     /* tp_doc */
        0,                                  /* tp_traverse */
        0,                                  /* tp_clear */
        0,                                  /* tp_richcompare */
        0,                                  /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
        0,                                  /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
        0,                                  /* tp_version */
#endif
#ifdef COUNT_ALLOCS
        0,0,0,0                             /* tp_alloc -> tp_next */
#endif
      };
      varlink_type = tmp;
      type_init = 1;
#if PY_VERSION_HEX < 0x02020000
      varlink_type.ob_type = &PyType_Type;
#else
      if (PyType_Ready(&varlink_type) < 0)
      return NULL;
#endif
    }
    return &varlink_type;
  }
  
  /* Create a variable linking object for use later */
  SWIGINTERN PyObject *
  SWIG_Python_newvarlink(void) {
    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
    if (result) {
      result->vars = 0;
    }
    return ((PyObject*) result);
  }
  
  SWIGINTERN void 
  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
    swig_varlinkobject *v = (swig_varlinkobject *) p;
    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
    if (gv) {
      size_t size = strlen(name)+1;
      gv->name = (char *)malloc(size);
      if (gv->name) {
        strncpy(gv->name,name,size);
        gv->get_attr = get_attr;
        gv->set_attr = set_attr;
        gv->next = v->vars;
      }
    }
    v->vars = gv;
  }
  
  SWIGINTERN PyObject *
  SWIG_globals(void) {
    static PyObject *_SWIG_globals = 0; 
    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
    return _SWIG_globals;
  }
  
  /* -----------------------------------------------------------------------------
   * constants/methods manipulation
   * ----------------------------------------------------------------------------- */
  
  /* Install Constants */
  SWIGINTERN void
  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
    PyObject *obj = 0;
    size_t i;
    for (i = 0; constants[i].type; ++i) {
      switch(constants[i].type) {
      case SWIG_PY_POINTER:
        obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
        break;
      case SWIG_PY_BINARY:
        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
        break;
      default:
        obj = 0;
        break;
      }
      if (obj) {
        PyDict_SetItemString(d, constants[i].name, obj);
        Py_DECREF(obj);
      }
    }
  }
  
  /* -----------------------------------------------------------------------------*/
  /* Fix SwigMethods to carry the callback ptrs when needed */
  /* -----------------------------------------------------------------------------*/
  
  SWIGINTERN void
  SWIG_Python_FixMethods(PyMethodDef *methods,
    swig_const_info *const_table,
    swig_type_info **types,
    swig_type_info **types_initial) {
    size_t i;
    for (i = 0; methods[i].ml_name; ++i) {
      const char *c = methods[i].ml_doc;
      if (c && (c = strstr(c, "swig_ptr: "))) {
        int j;
        swig_const_info *ci = 0;
        const char *name = c + 10;
        for (j = 0; const_table[j].type; ++j) {
          if (strncmp(const_table[j].name, name, 
              strlen(const_table[j].name)) == 0) {
            ci = &(const_table[j]);
            break;
          }
        }
        if (ci) {
          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
          if (ptr) {
            size_t shift = (ci->ptype) - types;
            swig_type_info *ty = types_initial[shift];
            size_t ldoc = (c - methods[i].ml_doc);
            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
            char *ndoc = (char*)malloc(ldoc + lptr + 10);
            if (ndoc) {
              char *buff = ndoc;
              strncpy(buff, methods[i].ml_doc, ldoc);
              buff += ldoc;
              strncpy(buff, "swig_ptr: ", 10);
              buff += 10;
              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
              methods[i].ml_doc = ndoc;
            }
          }
        }
      }
    }
  } 
  
#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------*
 *  Partial Init method
 * -----------------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C"
#endif

SWIGEXPORT 
#if PY_VERSION_HEX >= 0x03000000
PyObject*
#else
void
#endif
SWIG_init(void) {
  PyObject *m, *d, *md;
#if PY_VERSION_HEX >= 0x03000000
  static struct PyModuleDef SWIG_module = {
# if PY_VERSION_HEX >= 0x03020000
    PyModuleDef_HEAD_INIT,
# else
    {
      PyObject_HEAD_INIT(NULL)
      NULL, /* m_init */
      0,    /* m_index */
      NULL, /* m_copy */
    },
# endif
    (char *) SWIG_name,
    NULL,
    -1,
    SwigMethods,
    NULL,
    NULL,
    NULL,
    NULL
  };
#endif
  
#if defined(SWIGPYTHON_BUILTIN)
  static SwigPyClientData SwigPyObject_clientdata = {
    0, 0, 0, 0, 0, 0, 0
  };
  static PyGetSetDef this_getset_def = {
    (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
  };
  static SwigPyGetSet thisown_getset_closure = {
    (PyCFunction) SwigPyObject_own,
    (PyCFunction) SwigPyObject_own
  };
  static PyGetSetDef thisown_getset_def = {
    (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
  };
  PyObject *metatype_args;
  PyTypeObject *builtin_pytype;
  int builtin_base_count;
  swig_type_info *builtin_basetype;
  PyObject *tuple;
  PyGetSetDescrObject *static_getset;
  PyTypeObject *metatype;
  SwigPyClientData *cd;
  PyObject *public_interface, *public_symbol;
  PyObject *this_descr;
  PyObject *thisown_descr;
  int i;
  
  (void)builtin_pytype;
  (void)builtin_base_count;
  (void)builtin_basetype;
  (void)tuple;
  (void)static_getset;
  
  /* metatype is used to implement static member variables. */
  metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
  assert(metatype_args);
  metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
  assert(metatype);
  Py_DECREF(metatype_args);
  metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
  assert(PyType_Ready(metatype) >= 0);
#endif
  
  /* Fix SwigMethods to carry the callback ptrs when needed */
  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
  
#if PY_VERSION_HEX >= 0x03000000
  m = PyModule_Create(&SWIG_module);
#else
  m = Py_InitModule((char *) SWIG_name, SwigMethods);
#endif
  md = d = PyModule_GetDict(m);
  (void)md;
  
  SWIG_InitializeModule(0);
  
#ifdef SWIGPYTHON_BUILTIN
  SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
  assert(SwigPyObject_stype);
  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
  if (!cd) {
    SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
    SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
  } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
    PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
# if PY_VERSION_HEX >= 0x03000000
    return NULL;
# else
    return;
# endif
  }
  
  /* All objects have a 'this' attribute */
  this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
  (void)this_descr;
  
  /* All objects have a 'thisown' attribute */
  thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
  (void)thisown_descr;
  
  public_interface = PyList_New(0);
  public_symbol = 0;
  (void)public_symbol;
  
  PyDict_SetItemString(md, "__all__", public_interface);
  Py_DECREF(public_interface);
  for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
  SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
  for (i = 0; swig_const_table[i].name != 0; ++i)
  SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
#endif
  
  SWIG_InstallConstants(d,swig_const_table);
  
  SWIG_Python_SetConstant(d, "L2_LR",SWIG_From_int(static_cast< int >(nupic::algorithms::linear::L2_LR)));
  SWIG_Python_SetConstant(d, "L1_LR",SWIG_From_int(static_cast< int >(nupic::algorithms::linear::L1_LR)));
  SWIG_Python_SetConstant(d, "L2LOSS_SVM",SWIG_From_int(static_cast< int >(nupic::algorithms::linear::L2LOSS_SVM)));
  SWIG_Python_SetConstant(d, "cos45",SWIG_From_double(static_cast< double >(0.70710678118654746)));
  SWIG_Python_SetConstant(d, "CState_VERSION",SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::CState::VERSION)));
  SWIG_Python_SetConstant(d, "CStateIndexed_VERSION",SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::CStateIndexed::VERSION)));
  PyDict_SetItemString(md,(char*)"cvar", SWIG_globals());
  SWIG_addvarlink(SWIG_globals(),(char*)"_numTiers",Swig_var__numTiers_get, Swig_var__numTiers_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"_dutyCycleTiers",Swig_var__dutyCycleTiers_get, Swig_var__dutyCycleTiers_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"_dutyCycleAlphas",Swig_var__dutyCycleAlphas_get, Swig_var__dutyCycleAlphas_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"_MAX_CELLS",Swig_var__MAX_CELLS_get, Swig_var__MAX_CELLS_set);
  SWIG_addvarlink(SWIG_globals(),(char*)"_MAX_SEGS",Swig_var__MAX_SEGS_get, Swig_var__MAX_SEGS_set);
  SWIG_Python_SetConstant(d, "Cells4_VERSION",SWIG_From_unsigned_SS_int(static_cast< unsigned int >(nupic::algorithms::Cells4::Cells4::VERSION)));
  SWIG_addvarlink(SWIG_globals(),(char*)"Version",Swig_var_Version_get, Swig_var_Version_set);
#if PY_VERSION_HEX >= 0x03000000
  return m;
#else
  return;
#endif
}

